summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorDoris Verria <doris.verria@qt.io>2022-06-02 10:01:21 +0200
committerDoris Verria <doris.verria@qt.io>2022-06-03 19:43:20 +0200
commit259df3ca0b860f6ea485e7121dd7931f6ee18464 (patch)
tree0781a24f7c3dc87535ac6d1610502fef6e41f24b /src/plugins/platforms/ios
parent474792a751a1201fc8d88d6c00e322fdf35047b1 (diff)
qiostheme: Don't determine the appearance mode from the keyWindow
We were querying the traitCollection property of the application's keyWindow in order to determine the appearance mode (light/dark) of the app. However, the application may not have a keyWindow (visible window) by the time the we set up the appearance mode, so get that information from the last window in the application's windows array instead. Change-Id: If7435d9f565b5c594a26027c971c16a1e3a9af26 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qiostheme.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm
index e9525a0275..a03a0b9515 100644
--- a/src/plugins/platforms/ios/qiostheme.mm
+++ b/src/plugins/platforms/ios/qiostheme.mm
@@ -140,7 +140,7 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
QPlatformTheme::Appearance QIOSTheme::appearance() const
{
if (@available(ios 12, *)) {
- if (UIWindow *window = qt_apple_sharedApplication().keyWindow) {
+ if (UIWindow *window = qt_apple_sharedApplication().windows.lastObject) {
return window.rootViewController.traitCollection.userInterfaceStyle
== UIUserInterfaceStyleDark
? QPlatformTheme::Appearance::Dark