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 60f11cf637

Fixes: QTCREATORBUG-29741
Change-Id: I9e8defc6dd7193f5008decda0eda04dedc62f9df
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2023-10-25 14:23:57 +02:00
parent 042aa1aa25
commit 1a398a83b5

View File

@@ -874,8 +874,10 @@ QWidget *ICore::dialogParent()
QWidget *active = QApplication::activeModalWidget(); QWidget *active = QApplication::activeModalWidget();
if (!active) if (!active)
active = QApplication::activeWindow(); 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; active = d->m_mainwindow;
}
return active; return active;
} }