diff options
author | Ilya Fedin <fedin-ilja2010@ya.ru> | 2022-08-20 19:00:33 +0400 |
---|---|---|
committer | Ilya Fedin <fedin-ilja2010@ya.ru> | 2022-08-27 04:41:04 +0400 |
commit | f832c707caaa24528eb3048280576144eb13cda4 (patch) | |
tree | 0cdf29cddf3cb60599cc4c2c53e5b9b77ebbac3e /src | |
parent | e81e7c3d99a089b16929607a9d39b76608ce3b9a (diff) |
QGtk3Theme: subscribe to theme hint changes
Pick-to: 6.4
Change-Id: I67a9a0d06e88384c0bb6f5008609bcfbf504705f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index 44d9db8530..ab607a0c6d 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -7,6 +7,7 @@ #include <QVariant> #include <QtCore/qregularexpression.h> #include <QGuiApplication> +#include <qpa/qwindowsysteminterface.h> #undef signals #include <gtk/gtk.h> @@ -82,6 +83,25 @@ QGtk3Theme::QGtk3Theme() /* Use our custom log handler. */ g_log_set_handler("Gtk", G_LOG_LEVEL_MESSAGE, gtkMessageHandler, nullptr); + +#define SETTING_CONNECT(setting) g_signal_connect(settings, "notify::" setting, G_CALLBACK(notifyThemeChanged), nullptr) + auto notifyThemeChanged = [] { + QWindowSystemInterface::handleThemeChange(); + }; + + GtkSettings *settings = gtk_settings_get_default(); + SETTING_CONNECT("gtk-cursor-blink-time"); + SETTING_CONNECT("gtk-double-click-distance"); + SETTING_CONNECT("gtk-double-click-time"); + SETTING_CONNECT("gtk-long-press-time"); + SETTING_CONNECT("gtk-entry-password-hint-timeout"); + SETTING_CONNECT("gtk-dnd-drag-threshold"); + SETTING_CONNECT("gtk-icon-theme-name"); + SETTING_CONNECT("gtk-fallback-icon-theme"); + SETTING_CONNECT("gtk-font-name"); + SETTING_CONNECT("gtk-application-prefer-dark-theme"); + SETTING_CONNECT("gtk-theme-name"); +#undef SETTING_CONNECT } static inline QVariant gtkGetLongPressTime() |