diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-04-24 15:36:23 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-04-30 12:21:30 +0200 |
commit | 91d18c646443c812addf6d1cdada99d3c2d3a3ec (patch) | |
tree | 9d859c7a17da185073bc43bb4ab510af8e4cfdce /src/plugins/platforms/ios/qiosscreen.mm | |
parent | f9d219b92636fc279a3dc0c0e667b6668d0943db (diff) |
iOS: Pick up theme palette from system colors
For now we just fill out the system palette, and react to the system
changing theme from dark to light. A further improvement would be to
fill in the control-specific palettes.
Change-Id: I764db4415f5b55ccb193dae43e9f4386c765b30b
Fixes: QTBUG-42944
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios/qiosscreen.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosscreen.mm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 9aba658479..c3376c08e8 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -45,6 +45,7 @@ #include "qiosapplicationdelegate.h" #include "qiosviewcontroller.h" #include "quiview.h" +#include "qiostheme.h" #include <QtCore/private/qcore_mac_p.h> @@ -207,6 +208,18 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen) [super sendEvent:event]; } +- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection +{ + [super traitCollectionDidChange:previousTraitCollection]; + + if (self.screen == UIScreen.mainScreen) { + if (previousTraitCollection.userInterfaceStyle != self.traitCollection.userInterfaceStyle) { + QIOSTheme::initializeSystemPalette(); + QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::SynchronousDelivery>(nullptr); + } + } +} + @end // ------------------------------------------------------------------------- |