From 2f8a153561831e9c3a9ea0705b1b783c56c6c098 Mon Sep 17 00:00:00 2001 From: Pavel Artsishevsky Date: Mon, 31 Oct 2022 21:54:19 +0300 Subject: [PATCH] Fix applying dark scheme when QT_STYLE_OVERRIDE is set When QT_STYLE_OVERRIDE is set to something like "Adwaita-dark" it breaks the theme since it doesn't apply the corresponding color scheme. We should rely on QT_STYLE_OVERRIDE when deciding whether to use the dark theme. Signed-off-by: Pavel Artsishevsky --- src/common/gnomesettings.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/gnomesettings.cpp b/src/common/gnomesettings.cpp index 4491a80..078b1a9 100644 --- a/src/common/gnomesettings.cpp +++ b/src/common/gnomesettings.cpp @@ -213,9 +213,11 @@ bool GnomeSettings::canUseFileChooserPortal() const bool GnomeSettings::useGtkThemeDarkVariant() const { - const QString theme = m_hintProvider->gtkTheme(); - - if (m_hintProvider->canRelyOnAppearance()) { + QString theme = m_hintProvider->gtkTheme(); + if (qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE")) { + /* If QT_STYLE_OVERRIDE we should rely on it */ + theme = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE")); + } else if (m_hintProvider->canRelyOnAppearance()) { return m_hintProvider->appearance() == PreferDark; }