From 39a7e67085bf14107da646fa92235dfa98554f15 Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Date: Thu, 8 Jul 2021 18:24:47 -0300 Subject: [PATCH] Add parent widget to AddPerspective dialog to stop it being hidden raise doesn't fix the issue on Windows --- src/Gui/MainWindow.cpp | 2 +- src/Gui/Perspective.cpp | 7 ++----- src/Gui/Perspective.h | 2 +- src/Gui/PerspectiveDialog.cpp | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 5a2d9ebad..ad0d0aa09 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -1478,7 +1478,7 @@ MainWindow::perspectiveSelected(int index) { QString name; QString expression; - AddPerspectiveDialog *dialog= new AddPerspectiveDialog(currentTab->context, name, expression, current->type); + AddPerspectiveDialog *dialog= new AddPerspectiveDialog(this, currentTab->context, name, expression, current->type); int ret= dialog->exec(); delete dialog; if (ret == QDialog::Accepted && name != "") { diff --git a/src/Gui/Perspective.cpp b/src/Gui/Perspective.cpp index 23fadd6cc..4ceea90a8 100644 --- a/src/Gui/Perspective.cpp +++ b/src/Gui/Perspective.cpp @@ -1743,8 +1743,8 @@ ImportChartDialog::cancelClicked() accept(); } -AddPerspectiveDialog::AddPerspectiveDialog(Context *context, QString &name, QString &expression, int type, bool edit) : - context(context), name(name), expression(expression), type(type) +AddPerspectiveDialog::AddPerspectiveDialog(QWidget *parent, Context *context, QString &name, QString &expression, int type, bool edit) : + QDialog(parent), context(context), name(name), expression(expression), type(type) { setWindowFlags(windowFlags()); if (edit) setWindowTitle(tr("Edit Perspective")); @@ -1780,9 +1780,6 @@ AddPerspectiveDialog::AddPerspectiveDialog(Context *context, QString &name, QStr connect(add, SIGNAL(clicked()), this, SLOT(addClicked())); connect(cancel, SIGNAL(clicked()), this, SLOT(cancelClicked())); - - // want on top - raise(); } void diff --git a/src/Gui/Perspective.h b/src/Gui/Perspective.h index f64520fa3..7a96dcb58 100644 --- a/src/Gui/Perspective.h +++ b/src/Gui/Perspective.h @@ -242,7 +242,7 @@ class AddPerspectiveDialog : public QDialog Q_OBJECT public: - AddPerspectiveDialog(Context *context, QString &name, QString &expression, int type, bool edit=false); + AddPerspectiveDialog(QWidget *parent, Context *context, QString &name, QString &expression, int type, bool edit=false); protected: QLineEdit *nameEdit; diff --git a/src/Gui/PerspectiveDialog.cpp b/src/Gui/PerspectiveDialog.cpp index 2b0c3ae04..2245432ba 100644 --- a/src/Gui/PerspectiveDialog.cpp +++ b/src/Gui/PerspectiveDialog.cpp @@ -233,7 +233,7 @@ PerspectiveDialog::editPerspectiveClicked() Perspective *editing = tabView->perspectives_[index]; QString expression=editing->expression(); - AddPerspectiveDialog *dialog= new AddPerspectiveDialog(tabView->context, editing->title_, expression, tabView->type, true); + AddPerspectiveDialog *dialog= new AddPerspectiveDialog(this, tabView->context, editing->title_, expression, tabView->type, true); int ret= dialog->exec(); delete dialog; if (ret == QDialog::Accepted) { @@ -249,7 +249,7 @@ PerspectiveDialog::addPerspectiveClicked() { QString name; QString expression; - AddPerspectiveDialog *dialog= new AddPerspectiveDialog(tabView->context, name, expression, tabView->type); + AddPerspectiveDialog *dialog= new AddPerspectiveDialog(this, tabView->context, name, expression, tabView->type); int ret= dialog->exec(); delete dialog; if (ret == QDialog::Accepted && name != "") {