QGtk3Theme: subscribe to theme hint changes

Change-Id: I67a9a0d06e88384c0bb6f5008609bcfbf504705f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f832c707caaa24528eb3048280576144eb13cda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ilya Fedin 2022-08-20 19:00:33 +04:00 committed by Qt Cherry-pick Bot
parent f10b467a0b
commit 0fc6a211b5

View File

@ -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()