From 649ea75ea801832fd5d9a55b280d49fd13f60d68 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Thu, 29 Jun 2023 11:19:51 +0200 Subject: [PATCH] tweak dark palette behavvior bit more precise --- src/librssguard/miscellaneous/skinfactory.cpp | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/librssguard/miscellaneous/skinfactory.cpp b/src/librssguard/miscellaneous/skinfactory.cpp index 4876a111c..3cb9dfd8e 100644 --- a/src/librssguard/miscellaneous/skinfactory.cpp +++ b/src/librssguard/miscellaneous/skinfactory.cpp @@ -171,25 +171,24 @@ void SkinFactory::loadSkinFromData(const Skin& skin) { const bool use_skin_colors = skin.m_forcedSkinColors || qApp->settings()->value(GROUP(GUI), SETTING(GUI::ForcedSkinColors)).toBool(); - if (isStyleGoodForAlternativeStylePalette(m_currentStyle) && !skin.m_stylePalette.isEmpty() && use_skin_colors) { - qDebugNN << LOGSEC_GUI << "Activating alternative palette."; + if (isStyleGoodForAlternativeStylePalette(m_currentStyle)) { + if (!skin.m_stylePalette.isEmpty() && use_skin_colors) { + qDebugNN << LOGSEC_GUI << "Activating alternative palette."; - QPalette pal = skin.extractPalette(); + QPalette pal = skin.extractPalette(); - QToolTip::setPalette(pal); - qApp->setPalette(pal); - } - // NOTE: Very hacky way of avoiding automatic "dark mode" - // palettes in some styles. Also in light mode, - // colors are now derived from system. - // - // NOTE: At this point disabled as it effectively disables automatic "dark - // mode when it is enabled in OS settings. + QToolTip::setPalette(pal); + qApp->setPalette(pal); + } + // NOTE: Very hacky way of avoiding automatic "dark mode" + // palettes in some styles. Also in light mode, + // colors are now derived from system. #if QT_VERSION >= 0x060500 // Qt >= 6.5.0 - // else /* if (qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark) */ { - // qApp->setPalette(qt_fusionPalette(false)); - // } + else { + qApp->setPalette(qt_fusionPalette(qApp->styleHints()->colorScheme() == Qt::ColorScheme::Dark)); + } #endif + } if (!skin.m_rawData.isEmpty()) { if (qApp->styleSheet().simplified().isEmpty() && use_skin_colors) {