From e2dab7685c7e06c8c8fe84f38589fcb6d445755e Mon Sep 17 00:00:00 2001 From: Tobias Hunger <tobias.hunger@theqtcompany.com> Date: Wed, 3 Jun 2015 12:20:13 +0200 Subject: [PATCH] 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> --- src/plugins/coreplugin/icore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index f06fe01e37d..300790fe130 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -488,7 +488,11 @@ QWidget *ICore::mainWindow() QWidget *ICore::dialogParent() { QWidget *active = QApplication::activeModalWidget(); - return active ? active : m_mainwindow; + if (!active) + active = QApplication::activeWindow(); + if (!active) + active = m_mainwindow; + return active; } QStatusBar *ICore::statusBar() -- GitLab