diff options
author | Oliver Eftevaag <[email protected]> | 2025-02-20 18:27:50 +0100 |
---|---|---|
committer | Oliver Eftevaag <[email protected]> | 2025-03-28 17:44:39 +0100 |
commit | 4ac89dad78772ce90649b9846efa17319deba28f (patch) | |
tree | e7a2b51b6d7a19e56b8efdb39f8629437ca67601 /src/gui/platform/unix/qkdetheme.cpp | |
parent | 8c943392ae2ae554e496f11d9a3dd6c2c2e762e3 (diff) |
Add virtual member QPlatformTheme::contrastPreference()
This function can be overridden by individual platform themes, in order
to read contrast settings from the platform's system settings, and
report the result back to Qt.
This information is relevant for our styles, and can be used to
determine color palette values, and additional elements like outline
thickness for controls/widgets.
Currently only the Windows, macOS, Gnome and Flatpak themes support this
feature.
Task-number: QTBUG-133595
Change-Id: I3aff519aa7f07c8b2fdcc1e7fb35ec719ab8efcc
Reviewed-by: Tor Arne Vestbø <[email protected]>
Diffstat (limited to 'src/gui/platform/unix/qkdetheme.cpp')
-rw-r--r-- | src/gui/platform/unix/qkdetheme.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/platform/unix/qkdetheme.cpp b/src/gui/platform/unix/qkdetheme.cpp index 07df7124430..af6edbc3f8f 100644 --- a/src/gui/platform/unix/qkdetheme.cpp +++ b/src/gui/platform/unix/qkdetheme.cpp @@ -114,7 +114,7 @@ private: bool initDbus(); void settingChangedHandler(QDBusListener::Provider provider, QDBusListener::Setting setting, - const QString &value); + const QVariant &value); Qt::ColorScheme colorSchemeFromPalette() const; #endif // QT_NO_DBUS void clearResources(); @@ -123,21 +123,23 @@ private: #ifndef QT_NO_DBUS void QKdeThemePrivate::settingChangedHandler(QDBusListener::Provider provider, QDBusListener::Setting setting, - const QString &value) + const QVariant &value) { if (provider != QDBusListener::Provider::Kde) return; switch (setting) { case QDBusListener::Setting::ColorScheme: - qCDebug(lcQpaThemeKde) << "KDE color theme changed to:" << value; + qCDebug(lcQpaThemeKde) << "KDE color theme changed to:" << value.toUInt(); break; case QDBusListener::Setting::Theme: - qCDebug(lcQpaThemeKde) << "KDE global theme changed to:" << value; + qCDebug(lcQpaThemeKde) << "KDE global theme changed to:" << value.toString(); break; case QDBusListener::Setting::ApplicationStyle: - qCDebug(lcQpaThemeKde) << "KDE application style changed to:" << value; + qCDebug(lcQpaThemeKde) << "KDE application style changed to:" << value.toString(); break; + case QDBusListener::Setting::Contrast: + qCDebug(lcQpaThemeKde) << "KDE contrast setting changed to: " << static_cast<Qt::ContrastPreference>(value.toUInt()); } refresh(); @@ -158,7 +160,7 @@ bool QKdeThemePrivate::initDbus() // Wrap slot in a lambda to avoid inheriting QKdeThemePrivate from QObject auto wrapper = [this](QDBusListener::Provider provider, QDBusListener::Setting setting, - const QString &value) { + const QVariant &value) { settingChangedHandler(provider, setting, value); }; |