macOS: Always override NSApp.appearance on requestColorScheme

We can't compare to the effective appearance, as we'll then fail to
set an explicit appearance if the requested appearance matches the
current appearance, which results in the requested appearance not
sticking when the system appearance changes.

Pick-to: 6.8 6.5
Change-Id: Ibd8f7825051f1a67bed25a0abb2f1a13356f32d8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 05e59e37c83a15997fa20c10566a7be693fa07bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2025-04-15 23:58:16 +02:00 committed by Qt Cherry-pick Bot
parent b2b48ff26e
commit c4486be6bd

View File

@ -490,8 +490,11 @@ void QCocoaTheme::requestColorScheme(Qt::ColorScheme scheme)
case Qt::ColorScheme::Unknown:
break;
}
if (appearance != NSApp.effectiveAppearance)
NSApplication.sharedApplication.appearance = appearance;
// Always override the appearance, even if it's the same
// as the current effective appearance, as otherwise the
// requested appearance won't stick on system theme changes.
NSApp.appearance = appearance;
}
/*