From 5f74655b514bbe34e062aec95648fd8386b67de4 Mon Sep 17 00:00:00 2001 From: "Mark.lin" Date: Fri, 11 Sep 2026 17:38:29 +0800 Subject: [PATCH] Refresh the native preview window handle Compared with cde6c89: - Refresh the controller preview target immediately after the Qt preview window is shown during capture startup. - Refresh the target again after normal or fullscreen preview presentation before attaching the D3D preview renderer. - Restore the pre-refactor behavior of obtaining the current native window handle at each preview attachment instead of relying on the handle captured during MainWindow construction. Validation: git diff --cached --check passed. MSVC Release compilation completed, but final linking could not replace gvfg_qt_preview.exe because the currently running sample process held the output file open (LNK1104). No runtime preview, capture, audio playback, device-event, shutdown, MinGW, or hardware validation was run. --- GVFG_Qt_Sample/mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GVFG_Qt_Sample/mainwindow.cpp b/GVFG_Qt_Sample/mainwindow.cpp index 133b7e4..16cdbe8 100644 --- a/GVFG_Qt_Sample/mainwindow.cpp +++ b/GVFG_Qt_Sample/mainwindow.cpp @@ -76,7 +76,10 @@ MainWindow::MainWindow(QWidget *parent) if (width > 0 && height > 0) previewWindows_[channel]->setSourceSize(width, height); }); connect(controller_, &CaptureController::previewShowRequested, this, - [this](int channel) { previewWindows_[channel]->showPreview(); }); + [this](int channel) { + previewWindows_[channel]->showPreview(); + controller_->setPreviewTarget(channel, previewWindows_[channel]->nativePreviewHandle()); + }); connect(controller_, &CaptureController::previewCloseRequested, this, [this](int channel) { previewWindows_[channel]->closePreview(); }); @@ -159,6 +162,7 @@ void MainWindow::showPreviewWindow(int channel, bool fullscreen) previewWindows_[channel]->setSourceSize(signal.width, signal.height); if (fullscreen) previewWindows_[channel]->showFullscreenPreview(); else previewWindows_[channel]->showPreview(); + controller_->setPreviewTarget(channel, previewWindows_[channel]->nativePreviewHandle()); if (!controller_->applyPreview(channel)) controller_->logUiMessage( fullscreen