From 57b0f54bb68760958ea315d9ba2000c2a738270d Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 6 Dec 2016 14:48:46 +0300 Subject: GTK+ theme: Map some GtkSettings properties to QPlatformTheme hints Change-Id: If2525e7db0fa496805901174e62f382dd97b2846 Reviewed-by: J-P Nurmi --- src/plugins/platformthemes/gtk3/qgtk3theme.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/plugins/platformthemes/gtk3') diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp index 6df631bff3..7e64906476 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3theme.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3theme.cpp @@ -51,11 +51,18 @@ QT_BEGIN_NAMESPACE const char *QGtk3Theme::name = "gtk3"; -static QString gtkSetting(const gchar *propertyName) +template +static T gtkSetting(const gchar *propertyName) { GtkSettings *settings = gtk_settings_get_default(); - gchararray value; + T value; g_object_get(settings, propertyName, &value, NULL); + return value; +} + +static QString gtkSetting(const gchar *propertyName) +{ + gchararray value = gtkSetting(propertyName); QString str = QString::fromUtf8(value); g_free(value); return str; @@ -98,6 +105,18 @@ QGtk3Theme::QGtk3Theme() QVariant QGtk3Theme::themeHint(QPlatformTheme::ThemeHint hint) const { switch (hint) { + case QPlatformTheme::CursorFlashTime: + return QVariant(gtkSetting("gtk-cursor-blink-time")); + case QPlatformTheme::MouseDoubleClickDistance: + return QVariant(gtkSetting("gtk-double-click-distance")); + case QPlatformTheme::MouseDoubleClickInterval: + return QVariant(gtkSetting("gtk-double-click-time")); + case QPlatformTheme::MousePressAndHoldInterval: + return QVariant(gtkSetting("gtk-long-press-time")); + case QPlatformTheme::PasswordMaskDelay: + return QVariant(gtkSetting("gtk-entry-password-hint-timeout")); + case QPlatformTheme::StartDragDistance: + return QVariant(gtkSetting("gtk-dnd-drag-threshold")); case QPlatformTheme::SystemIconThemeName: return QVariant(gtkSetting("gtk-icon-theme-name")); case QPlatformTheme::SystemIconFallbackThemeName: -- cgit v1.2.3