MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / refreshAfterReparent

Function refreshAfterReparent

src/gui/PanadapterStack.cpp:20–40  ·  view source on GitHub ↗

After moving a QRhiWidget between top-level windows, force a fresh initialize() cycle so Metal binds to the new NSView. The backing-store notification is sent before the actual reparent; sending it again here can make QRhiWidget remove a stale cleanup callback from the wrong QRhi during startup floating restore.

Source from the content-addressed store, hash-verified

18// before the actual reparent; sending it again here can make QRhiWidget remove a
19// stale cleanup callback from the wrong QRhi during startup floating restore.
20static void refreshAfterReparent(AetherSDR::SpectrumWidget* sw)
21{
22 if (!sw) return;
23#if defined(Q_OS_MAC) && defined(AETHER_GPU_SPECTRUM)
24 const bool wasVisible = sw->isVisible();
25 sw->hide();
26 sw->resetGpuResources();
27 if (QWindow* windowHandle = sw->windowHandle()) {
28 windowHandle->destroy();
29 }
30 if (AetherSDR::SpectrumWidget::nativeWindowPreferred()) {
31 sw->setAttribute(Qt::WA_NativeWindow);
32 }
33 if (wasVisible) {
34 sw->show();
35 }
36 QTimer::singleShot(50, sw, [sw]() { sw->update(); });
37#else
38 sw->resetGpuResources();
39#endif
40}
41
42namespace AetherSDR {
43

Callers 3

rearrangeLayoutMethod · 0.85
floatPanadapterMethod · 0.85
dockPanadapterMethod · 0.85

Calls 2

resetGpuResourcesMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected