Core: Improve dialogParent() to work better with detached windows

Make new windows center on the window the user is currently looking
at instead of the mainwindow.

Change-Id: Ia6246a4f1935b6d2d66db329c6141f4cb8349916
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-06-03 12:20:13 +02:00
parent 86b50d83c0
commit e2dab7685c

View File

@@ -488,7 +488,11 @@ QWidget *ICore::mainWindow()
QWidget *ICore::dialogParent() QWidget *ICore::dialogParent()
{ {
QWidget *active = QApplication::activeModalWidget(); QWidget *active = QApplication::activeModalWidget();
return active ? active : m_mainwindow; if (!active)
active = QApplication::activeWindow();
if (!active)
active = m_mainwindow;
return active;
} }
QStatusBar *ICore::statusBar() QStatusBar *ICore::statusBar()