From 91d18c646443c812addf6d1cdada99d3c2d3a3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 24 Apr 2020 15:36:23 +0200 Subject: 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 --- src/plugins/platforms/ios/qiosscreen.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/plugins/platforms/ios/qiosscreen.mm') 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 @@ -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(nullptr); + } + } +} + @end // ------------------------------------------------------------------------- -- cgit v1.2.3