diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-04-19 10:41:01 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-04-23 16:44:26 +0200 |
commit | eee575595b11f4c2621a71ad89fcfde3b204e59f (patch) | |
tree | febe0a1967c542ed1e3e5fb0f00cb808d6b09ec0 /src/plugins | |
parent | c1f1523047b2e005fb7442847c2aa000faa7d0ac (diff) |
ColorScheme: clean up code to prepare adding a setter
The current QStyleHintsPrivate::setColorScheme is called when the system
theme changes, handling the change and informing the application. It is
not a setter. When we add a public setter, that setter will have to go
through the QPlatformTheme to request an override for the application.
That will then result in a call back to the QStyleHints to update the
theme with the effective color scheme (or ignore the request for the
override, on some platforms).
Rename it (and similar misleading APIs in platform plugins) to
updateColorScheme, and adjust outdated comments in some of the platform
plugins.
Task-number: QTBUG-124490
Change-Id: I6a852211254993df86acf2e2d42cf345e7401f4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/plugins')
3 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 206bbd03d6..0de83ccb28 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -703,7 +703,7 @@ Q_DECLARE_JNI_NATIVE_METHOD(handleScreenRemoved) static void handleUiDarkModeChanged(JNIEnv */*env*/, jobject /*thiz*/, jint newUiMode) { - QAndroidPlatformIntegration::setColorScheme( + QAndroidPlatformIntegration::updateColorScheme( (newUiMode == 1 ) ? Qt::ColorScheme::Dark : Qt::ColorScheme::Light); } Q_DECLARE_JNI_NATIVE_METHOD(handleUiDarkModeChanged) diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 038fe5172a..4d9e6fa704 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -537,7 +537,7 @@ void QAndroidPlatformIntegration::setScreenSize(int width, int height) Qt::ColorScheme QAndroidPlatformIntegration::m_colorScheme = Qt::ColorScheme::Light; -void QAndroidPlatformIntegration::setColorScheme(Qt::ColorScheme colorScheme) +void QAndroidPlatformIntegration::updateColorScheme(Qt::ColorScheme colorScheme) { if (m_colorScheme == colorScheme) return; diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index 5f1126fafc..b7bfb58d1d 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -110,7 +110,7 @@ public: void flushPendingUpdates(); - static void setColorScheme(Qt::ColorScheme colorScheme); + static void updateColorScheme(Qt::ColorScheme colorScheme); static Qt::ColorScheme colorScheme() { return m_colorScheme; } #if QT_CONFIG(vulkan) QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; |