diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-06-02 09:10:40 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-06-02 11:44:53 +0000 |
commit | 5b364de1685e5bee5953e23da2552b5db4455a74 (patch) | |
tree | 13f505553880048143feea6678dbd09e31558599 /src/plugins/resourceeditor/resourceeditorplugin.cpp | |
parent | 26d46fc19dccb3b599dcd24f2a3701b7c4e25d2b (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/resourceeditor/resourceeditorplugin.cpp')
-rw-r--r-- | src/plugins/resourceeditor/resourceeditorplugin.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index b6d35956da..eb5fb48edb 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -284,7 +284,7 @@ void ResourceEditorPluginPrivate::addPrefixContextMenu() { auto topLevel = dynamic_cast<ResourceTopLevelNode *>(ProjectTree::currentNode()); QTC_ASSERT(topLevel, return); - PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::mainWindow()); + PrefixLangDialog dialog(tr("Add Prefix"), QString(), QString(), Core::ICore::dialogParent()); if (dialog.exec() != QDialog::Accepted) return; QString prefix = dialog.prefix(); @@ -297,7 +297,7 @@ void ResourceEditorPluginPrivate::removePrefixContextMenu() { auto rfn = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode()); QTC_ASSERT(rfn, return); - if (QMessageBox::question(Core::ICore::mainWindow(), + if (QMessageBox::question(Core::ICore::dialogParent(), tr("Remove Prefix"), tr("Remove prefix %1 and all its files?").arg(rfn->displayName())) == QMessageBox::Yes) { @@ -326,7 +326,7 @@ void ResourceEditorPluginPrivate::removeFileContextMenu() FolderNode *parent = rfn->parentFolderNode(); QTC_ASSERT(parent, return); if (parent->removeFiles(QStringList() << path) != RemovedFilesFromProject::Ok) - QMessageBox::warning(Core::ICore::mainWindow(), + QMessageBox::warning(Core::ICore::dialogParent(), tr("File Removal Failed"), tr("Removing file %1 from the project failed.").arg(path)); } @@ -355,7 +355,10 @@ void ResourceEditorPluginPrivate::renamePrefixContextMenu() auto node = dynamic_cast<ResourceFolderNode *>(ProjectTree::currentNode()); QTC_ASSERT(node, return); - PrefixLangDialog dialog(tr("Rename Prefix"), node->prefix(), node->lang(), Core::ICore::mainWindow()); + PrefixLangDialog dialog(tr("Rename Prefix"), + node->prefix(), + node->lang(), + Core::ICore::dialogParent()); if (dialog.exec() != QDialog::Accepted) return; QString prefix = dialog.prefix(); |