diff options
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformtheme.cpp')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformtheme.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index 7b9072df69..99eeabac1d 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -161,7 +161,10 @@ QJsonObject AndroidStyle::loadStyleData() if (!stylePath.isEmpty() && !stylePath.endsWith(slashChar)) stylePath += slashChar; - if (QAndroidPlatformIntegration::colorScheme() == Qt::ColorScheme::Dark) + const Qt::ColorScheme colorScheme = QAndroidPlatformTheme::instance() + ? QAndroidPlatformTheme::instance()->colorScheme() + : QAndroidPlatformIntegration::colorScheme(); + if (colorScheme == Qt::ColorScheme::Dark) stylePath += "darkUiMode/"_L1; Q_ASSERT(!stylePath.isEmpty()); @@ -423,9 +426,19 @@ void QAndroidPlatformTheme::showPlatformMenuBar() Qt::ColorScheme QAndroidPlatformTheme::colorScheme() const { + if (m_colorSchemeOverride != Qt::ColorScheme::Unknown) + return m_colorSchemeOverride; return QAndroidPlatformIntegration::colorScheme(); } +void QAndroidPlatformTheme::requestColorScheme(Qt::ColorScheme scheme) +{ + m_colorSchemeOverride = scheme; + QMetaObject::invokeMethod(qGuiApp, [this]{ + updateColorScheme(); + }); +} + static inline int paletteType(QPlatformTheme::Palette type) { switch (type) { |