Windows: Check for bitmask instead for equality for initial window flags

fixTopLevelWindowFlags uses a equality comparison for the initial window
flags fixup. In case window flags are set before creation, this equality
will fail and no initial window flag fixup will happen. This patch
changes the equality comparison with a test for bitmasks.

Change-Id: I5a18f37376af5cc72f5ee7a3365970ca7fd51b66
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Wladimir Leuschner 2025-02-10 15:13:09 +01:00
parent ee942d7ab4
commit 369be48510

View File

@ -654,18 +654,13 @@ static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags)
{
// Not supported on Windows, also do correction when it is set.
flags &= ~Qt::WindowFullscreenButtonHint;
switch (flags) {
case Qt::Window:
if (flags.testFlags((Qt::Dialog | Qt::Tool) & ~Qt::Window)) {
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
} else if (flags.testFlag(Qt::Window)) {
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint
|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint;
break;
case Qt::Dialog:
case Qt::Tool:
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
break;
default:
break;
}
if ((flags & Qt::WindowType_Mask) == Qt::SplashScreen)
flags |= Qt::FramelessWindowHint;
}