Make Gnome theme react to color theme changes without GTK

Qt doesn't react to color theme changes on systems running Gnome
without GTK.

This patch adds support for such in QGnomeTheme, following
https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/

Pick-to: 6.5
Change-Id: I1f6252d4f394b810b9e4aebe00f2715c8fec3b56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Axel Spoerl 2023-05-13 11:37:52 +02:00
parent 486a89f7bb
commit 227b639499

View File

@ -375,6 +375,9 @@ void QGenericUnixThemeDBusListener::populateSignalMap()
m_signalMap.insert(DBusKey("org.gnome.desktop.interface"_L1, "gtk-theme"_L1),
ChangeSignal(Provider::Gtk, Setting::Theme));
m_signalMap.insert(DBusKey("org.freedesktop.appearance"_L1, "color-scheme"_L1),
ChangeSignal(Provider::Gnome, Setting::ColorTheme));
const QString &saveJsonFile = qEnvironmentVariable("QT_QPA_DBUS_SIGNALS_SAVE");
if (!saveJsonFile.isEmpty())
saveJson(saveJsonFile);