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.
This commit is contained in:
Mark.lin
2026-09-11 17:38:29 +08:00
parent cde6c89a83
commit 5f74655b51
+5 -1
View File
@@ -76,7 +76,10 @@ MainWindow::MainWindow(QWidget *parent)
if (width > 0 && height > 0) previewWindows_[channel]->setSourceSize(width, height); if (width > 0 && height > 0) previewWindows_[channel]->setSourceSize(width, height);
}); });
connect(controller_, &CaptureController::previewShowRequested, this, 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, connect(controller_, &CaptureController::previewCloseRequested, this,
[this](int channel) { previewWindows_[channel]->closePreview(); }); [this](int channel) { previewWindows_[channel]->closePreview(); });
@@ -159,6 +162,7 @@ void MainWindow::showPreviewWindow(int channel, bool fullscreen)
previewWindows_[channel]->setSourceSize(signal.width, signal.height); previewWindows_[channel]->setSourceSize(signal.width, signal.height);
if (fullscreen) previewWindows_[channel]->showFullscreenPreview(); if (fullscreen) previewWindows_[channel]->showFullscreenPreview();
else previewWindows_[channel]->showPreview(); else previewWindows_[channel]->showPreview();
controller_->setPreviewTarget(channel, previewWindows_[channel]->nativePreviewHandle());
if (!controller_->applyPreview(channel)) if (!controller_->applyPreview(channel))
controller_->logUiMessage( controller_->logUiMessage(
fullscreen fullscreen