From 1a398a83b51b9e220fd95993d0872bf4baba0723 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 25 Oct 2023 14:23:57 +0200 Subject: [PATCH] Core: Fix dialogParent for separate windows The dialog parent is supposed to fall back to the main window, if there is no modal window and the active window is not a popup or a splash screen. But testing for "popup or splash screen" does not work with `testAnyFlags(Popup | SplashScreen)` because these flags are combined flags - e.g. "Popup" is "Window + something", so when using testAnyFlags(Popup), that returns true for _any_ Window, regardless of popup or not. Amends 60f11cf6371fd6f482d257c54a48070874dc4b73 Fixes: QTCREATORBUG-29741 Change-Id: I9e8defc6dd7193f5008decda0eda04dedc62f9df Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/coreplugin/icore.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index eaf94e45cf5..1c04ebd2b6d 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -874,8 +874,10 @@ QWidget *ICore::dialogParent() QWidget *active = QApplication::activeModalWidget(); if (!active) active = QApplication::activeWindow(); - if (!active || (active && active->windowFlags().testAnyFlags(Qt::SplashScreen | Qt::Popup))) + if (!active || active->windowFlags().testFlag(Qt::SplashScreen) + || active->windowFlags().testFlag(Qt::Popup)) { active = d->m_mainwindow; + } return active; }