QIOSTheme: Get the appearance mode from the UIWindow's traitCollection
We were getting the appearance (light/dark) through the traitCollection of the UIWindow's rootViewController. It looks like this does not report the correct value when the appearance changes through System Settings. If we get it directly from the UIWindow's traitCollection property, it works as it should. Also, in traitCollectionDidChange: we are checking for changes in the traitCollection of the UIWindow's, not of the viewController's. Change-Id: I437e6922b268fd0069d80557a1034391ed52644b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
11be4c5ce8
commit
26b3a466d7
@ -135,7 +135,7 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const
|
||||
Qt::Appearance QIOSTheme::appearance() const
|
||||
{
|
||||
if (UIWindow *window = qt_apple_sharedApplication().windows.lastObject) {
|
||||
return window.rootViewController.traitCollection.userInterfaceStyle
|
||||
return window.traitCollection.userInterfaceStyle
|
||||
== UIUserInterfaceStyleDark
|
||||
? Qt::Appearance::Dark
|
||||
: Qt::Appearance::Light;
|
||||
|
Loading…
x
Reference in New Issue
Block a user