parent
dece265666
commit
3a47bd4a54
@ -0,0 +1,46 @@
|
|||||||
|
From 2cd530626aeafd861c65b434af85d5153da618a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Grulich <jgrulich@redhat.com>
|
||||||
|
Date: Thu, 9 Mar 2023 11:19:28 +0100
|
||||||
|
Subject: [PATCH] KColorSchemeManager: don't override color scheme set by
|
||||||
|
platform theme
|
||||||
|
|
||||||
|
This allows to have Qt platform theme setting the color scheme before
|
||||||
|
it gets set and overriden by KColorSchemeManager. This is useful for 3rd
|
||||||
|
party platform themes like QGnomePlatform, allowing them to set a color
|
||||||
|
scheme that would complement QPalette. Since many KDE apps rely on using
|
||||||
|
KColorScheme, it can happen that they will use a color from KColorScheme
|
||||||
|
that doesn't correspond to QPalette set through the platform theme and
|
||||||
|
end up being broken.
|
||||||
|
|
||||||
|
BUG: 447029
|
||||||
|
---
|
||||||
|
src/kcolorschememanager.cpp | 13 +++++++++++--
|
||||||
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/kcolorschememanager.cpp b/src/kcolorschememanager.cpp
|
||||||
|
index 4c7e3be0..0c845555 100644
|
||||||
|
--- a/src/kcolorschememanager.cpp
|
||||||
|
+++ b/src/kcolorschememanager.cpp
|
||||||
|
@@ -109,8 +109,17 @@ KColorSchemeManager::KColorSchemeManager(QObject *parent)
|
||||||
|
QString schemePath;
|
||||||
|
|
||||||
|
if (scheme.isEmpty() || scheme == QLatin1String("Default")) {
|
||||||
|
- schemePath = d->automaticColorSchemePath();
|
||||||
|
- d->m_defaultSchemeSelected = true;
|
||||||
|
+ // Color scheme might be already set from a platform theme
|
||||||
|
+ // This is used for example by QGnomePlatform that can set color scheme
|
||||||
|
+ // matching GNOME settings. This avoids issues where QGnomePlatform sets
|
||||||
|
+ // QPalette for dark theme, but end up mixing it also with Breeze light
|
||||||
|
+ // that is going to be used as a fallback for apps using KColorScheme.
|
||||||
|
+ // BUG: 447029
|
||||||
|
+ schemePath = qApp->property("KDE_COLOR_SCHEME_PATH").toString();
|
||||||
|
+ if (schemePath.isEmpty()) {
|
||||||
|
+ schemePath = d->automaticColorSchemePath();
|
||||||
|
+ d->m_defaultSchemeSelected = true;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
schemePath = indexForScheme(scheme).data(KColorSchemeModel::PathRole).toString();
|
||||||
|
d->m_defaultSchemeSelected = false;
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
From 1a8a574e0e1d379797b0745ce5ac0451a7104429 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nicolas Fella <nicolas.fella@gmx.de>
|
|
||||||
Date: Thu, 23 Dec 2021 12:33:10 +0100
|
|
||||||
Subject: [PATCH] [kcolorschememanager] Properly restore default palette
|
|
||||||
|
|
||||||
Currently when activating the default colorscheme we create a palette from the default KColorScheme
|
|
||||||
|
|
||||||
However that is different from the application's default palette
|
|
||||||
|
|
||||||
The former is effectively Breeze colors while the latter is fetched from the platformtheme
|
|
||||||
|
|
||||||
By setting a default-constructed QPalette we tell Qt to load the default palette
|
|
||||||
|
|
||||||
BUG: 447029
|
|
||||||
---
|
|
||||||
src/kcolorschememanager.cpp | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/kcolorschememanager.cpp b/src/kcolorschememanager.cpp
|
|
||||||
index 4c7e3be..c05a839 100644
|
|
||||||
--- a/src/kcolorschememanager.cpp
|
|
||||||
+++ b/src/kcolorschememanager.cpp
|
|
||||||
@@ -32,7 +32,11 @@ void KColorSchemeManagerPrivate::activateSchemeInternal(const QString &colorSche
|
|
||||||
// ApplicationPaletteChange event.
|
|
||||||
qApp->setProperty("KDE_COLOR_SCHEME_PATH", colorSchemePath);
|
|
||||||
if (colorSchemePath.isEmpty()) {
|
|
||||||
- qApp->setPalette(KColorScheme::createApplicationPalette(KSharedConfig::Ptr(nullptr)));
|
|
||||||
+ const QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP");
|
|
||||||
+ if (currentDesktop != QByteArray("KDE"))
|
|
||||||
+ qApp->setPalette(QPalette());
|
|
||||||
+ else
|
|
||||||
+ qApp->setPalette(KColorScheme::createApplicationPalette(KSharedConfig::Ptr(nullptr)));
|
|
||||||
} else {
|
|
||||||
qApp->setPalette(KColorScheme::createApplicationPalette(KSharedConfig::openConfig(colorSchemePath)));
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in new issue