From 1c2bd7809d79961c9c7969aea68fcd5eb84194e3 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Mon, 13 May 2024 17:36:26 +0200 Subject: [PATCH] QKdeTheme: update color scheme with unknown desktop theme When a KDE theme name doesn't contain the keywords "dark" or "light", QKdeThemePrivate::updateColorScheme() falls back to heuristics. It compares text and base color. It sets the color scheme to dark, if text is lighter than base and otherwise to light. When the theme name can't be read from KDE settings, because it is stored on a different location or not yet set, the heuristics fallback doesn't happen. The color scheme always becomes "Unknown". Remove this limitation to the benefit of currently unsupported Linuxes. Fixes: QTBUG-125285 Change-Id: I120dd23eee71b14ea8ce3735c3f53bda2caa403e Reviewed-by: Volker Hilsheimer (cherry picked from commit 71d0de98359decfcc9be01a0ed5823a9595ef5d4) Reviewed-by: Qt Cherry-pick Bot --- src/gui/platform/unix/qgenericunixthemes.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/platform/unix/qgenericunixthemes.cpp b/src/gui/platform/unix/qgenericunixthemes.cpp index 0fccd5304f6..67de34923fd 100644 --- a/src/gui/platform/unix/qgenericunixthemes.cpp +++ b/src/gui/platform/unix/qgenericunixthemes.cpp @@ -833,10 +833,7 @@ void QKdeThemePrivate::refresh() const QVariant colorScheme = readKdeSetting(KdeSetting::ColorScheme); - if (colorScheme.isValid()) - updateColorScheme(colorScheme.toString()); - else - m_colorScheme = Qt::ColorScheme::Unknown; + updateColorScheme(colorScheme.toString()); const QVariant singleClickValue = readKdeSetting(KdeSetting::SingleClick); if (singleClickValue.isValid())