aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-06-02 09:10:40 +0200
committerEike Ziller <eike.ziller@qt.io>2020-06-02 11:44:53 +0000
commit5b364de1685e5bee5953e23da2552b5db4455a74 (patch)
tree13f505553880048143feea6678dbd09e31558599 /src/plugins/qtsupport
parent26d46fc19dccb3b599dcd24f2a3701b7c4e25d2b (diff)
Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly. Especially for modal dialogs, using dialogParent() is important, since that guarantees the stacking order in case of other dialogs currently being open. Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r--src/plugins/qtsupport/gettingstartedwelcomepage.cpp14
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp2
-rw-r--r--src/plugins/qtsupport/qtversionmanager.cpp2
3 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index cfd675158d..7a048dfa3e 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -85,7 +85,7 @@ Id ExamplesWelcomePage::id() const
QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileInfo, QStringList &filesToOpen, const QStringList& dependencies)
{
const QString projectDir = proFileInfo.canonicalPath();
- QDialog d(ICore::mainWindow());
+ QDialog d(ICore::dialogParent());
auto lay = new QGridLayout(&d);
auto descrLbl = new QLabel;
d.setWindowTitle(tr("Copy Project to writable Location?"));
@@ -130,10 +130,12 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
QDir toDirWithExamplesDir(destBaseDir);
if (toDirWithExamplesDir.cd(exampleDirName)) {
toDirWithExamplesDir.cdUp(); // step out, just to not be in the way
- QMessageBox::warning(ICore::mainWindow(), tr("Cannot Use Location"),
+ QMessageBox::warning(ICore::dialogParent(),
+ tr("Cannot Use Location"),
tr("The specified location already exists. "
"Please specify a valid location."),
- QMessageBox::Ok, QMessageBox::NoButton);
+ QMessageBox::Ok,
+ QMessageBox::NoButton);
return QString();
} else {
QString error;
@@ -150,7 +152,9 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
.pathAppended(QDir(dependency).dirName());
if (!FileUtils::copyRecursively(FilePath::fromString(dependency), targetFile,
&error)) {
- QMessageBox::warning(ICore::mainWindow(), tr("Cannot Copy Project"), error);
+ QMessageBox::warning(ICore::dialogParent(),
+ tr("Cannot Copy Project"),
+ error);
// do not fail, just warn;
}
}
@@ -158,7 +162,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
return targetDir + QLatin1Char('/') + proFileInfo.fileName();
} else {
- QMessageBox::warning(ICore::mainWindow(), tr("Cannot Copy Project"), error);
+ QMessageBox::warning(ICore::dialogParent(), tr("Cannot Copy Project"), error);
}
}
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index 7a8466f81f..b389e8cf29 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -135,7 +135,7 @@ static void askAboutQtInstallation()
info.setCustomButtonInfo(QtSupportPlugin::tr("Link with Qt"), [] {
ICore::infoBar()->removeInfo(kLinkWithQtInstallationSetting);
ICore::infoBar()->globallySuppressInfo(kLinkWithQtInstallationSetting);
- QTimer::singleShot(0, ICore::mainWindow(), &QtOptionsPage::linkWithQt);
+ QTimer::singleShot(0, ICore::dialogParent(), &QtOptionsPage::linkWithQt);
});
ICore::infoBar()->addInfo(info);
}
diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp
index 4616ec9e51..504a4961d2 100644
--- a/src/plugins/qtsupport/qtversionmanager.cpp
+++ b/src/plugins/qtsupport/qtversionmanager.cpp
@@ -386,7 +386,7 @@ static void saveQtVersions()
data.insert(QString::fromLatin1(QTVERSION_DATA_KEY) + QString::number(count), tmp);
++count;
}
- m_writer->save(data, Core::ICore::mainWindow());
+ m_writer->save(data, Core::ICore::dialogParent());
}
// Executes qtchooser with arguments in a process and returns its output