From 94f469b361276a8c4df5f70bc6ad17bc67540f38 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 23 Sep 2019 13:14:28 +0100 Subject: [PATCH] Open capture with options should not be a top-level window --- qrenderdoc/Windows/MainWindow.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 831ebbeec..29d99b11d 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -453,29 +453,34 @@ void MainWindow::on_action_Open_Capture_with_Options_triggered() ReplayOptionsSelector *replayOptions = new ReplayOptionsSelector(m_Ctx, true, this); - QDialog openWithOptions; - openWithOptions.setWindowFlags(openWithOptions.windowFlags() & ~Qt::WindowContextHelpButtonHint); - openWithOptions.setWindowIcon(windowIcon()); - openWithOptions.setWindowTitle(tr("Open Capture with Options")); - openWithOptions.setSizeGripEnabled(false); - openWithOptions.setModal(true); + QDialog *openWithOptions = new QDialog(this); + openWithOptions->setWindowFlags(openWithOptions->windowFlags() & ~Qt::WindowContextHelpButtonHint); + openWithOptions->setWindowIcon(windowIcon()); + openWithOptions->setWindowTitle(tr("Open Capture with Options")); + openWithOptions->setSizeGripEnabled(false); + openWithOptions->setModal(true); QVBoxLayout l; l.addWidget(replayOptions); l.setMargin(3); l.setSizeConstraint(QLayout::SetFixedSize); - openWithOptions.setLayout(&l); + openWithOptions->setLayout(&l); - QObject::connect(replayOptions, &ReplayOptionsSelector::canceled, &openWithOptions, + QObject::connect(replayOptions, &ReplayOptionsSelector::canceled, openWithOptions, &QDialog::reject); - QObject::connect(replayOptions, &ReplayOptionsSelector::opened, &openWithOptions, &QDialog::accept); + QObject::connect(replayOptions, &ReplayOptionsSelector::opened, openWithOptions, &QDialog::accept); - if(RDDialog::show(&openWithOptions) != QDialog::Accepted) + if(RDDialog::show(openWithOptions) != QDialog::Accepted) + { + openWithOptions->deleteLater(); return; + } QString filename = replayOptions->filename(); + openWithOptions->deleteLater(); + if(filename.isEmpty()) return;