forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -187,7 +187,7 @@ void MacroManagerPrivate::changeMacroDescription(Macro *macro, const QString &de
|
||||
if (!macro->load())
|
||||
return;
|
||||
macro->setDescription(description);
|
||||
macro->save(macro->fileName(), Core::ICore::mainWindow());
|
||||
macro->save(macro->fileName(), Core::ICore::dialogParent());
|
||||
|
||||
QAction *action = actions[macro->displayName()];
|
||||
QTC_ASSERT(action, return);
|
||||
@@ -210,9 +210,10 @@ bool MacroManagerPrivate::executeMacro(Macro *macro)
|
||||
}
|
||||
|
||||
if (error) {
|
||||
QMessageBox::warning(Core::ICore::mainWindow(),
|
||||
MacroManager::tr("Playing Macro"),
|
||||
MacroManager::tr("An error occurred while replaying the macro, execution stopped."));
|
||||
QMessageBox::warning(
|
||||
Core::ICore::dialogParent(),
|
||||
MacroManager::tr("Playing Macro"),
|
||||
MacroManager::tr("An error occurred while replaying the macro, execution stopped."));
|
||||
}
|
||||
|
||||
// Set the focus back to the editor
|
||||
@@ -225,8 +226,7 @@ bool MacroManagerPrivate::executeMacro(Macro *macro)
|
||||
|
||||
void MacroManagerPrivate::showSaveDialog()
|
||||
{
|
||||
QWidget *mainWindow = Core::ICore::mainWindow();
|
||||
SaveDialog dialog(mainWindow);
|
||||
SaveDialog dialog(Core::ICore::dialogParent());
|
||||
if (dialog.exec()) {
|
||||
if (dialog.name().isEmpty())
|
||||
return;
|
||||
@@ -235,7 +235,7 @@ void MacroManagerPrivate::showSaveDialog()
|
||||
QString fileName = q->macrosDirectory() + QLatin1Char('/') + dialog.name()
|
||||
+ QLatin1Char('.') + QLatin1String(Constants::M_EXTENSION);
|
||||
currentMacro->setDescription(dialog.description());
|
||||
currentMacro->save(fileName, mainWindow);
|
||||
currentMacro->save(fileName, Core::ICore::dialogParent());
|
||||
addMacro(currentMacro);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user