summaryrefslogtreecommitdiffstats
path: root/src/plugins/platformthemes/gtk3
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2016-12-06 14:48:46 +0300
committerDmitry Shachnev <mitya57@gmail.com>2016-12-12 13:51:29 +0000
commit57b0f54bb68760958ea315d9ba2000c2a738270d (patch)
tree8a15b8b312e2fd95083470d8139f3a6b58d21c30 /src/plugins/platformthemes/gtk3
parent742a65a4d308f29f8711667462cbc655f9660c34 (diff)
GTK+ theme: Map some GtkSettings properties to QPlatformTheme hints
Change-Id: If2525e7db0fa496805901174e62f382dd97b2846 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/plugins/platformthemes/gtk3')
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.cpp23
1 files changed, 21 insertions, 2 deletions
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 <typename T>
+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<gchararray>(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<gint>("gtk-cursor-blink-time"));
+ case QPlatformTheme::MouseDoubleClickDistance:
+ return QVariant(gtkSetting<gint>("gtk-double-click-distance"));
+ case QPlatformTheme::MouseDoubleClickInterval:
+ return QVariant(gtkSetting<gint>("gtk-double-click-time"));
+ case QPlatformTheme::MousePressAndHoldInterval:
+ return QVariant(gtkSetting<guint>("gtk-long-press-time"));
+ case QPlatformTheme::PasswordMaskDelay:
+ return QVariant(gtkSetting<guint>("gtk-entry-password-hint-timeout"));
+ case QPlatformTheme::StartDragDistance:
+ return QVariant(gtkSetting<gint>("gtk-dnd-drag-threshold"));
case QPlatformTheme::SystemIconThemeName:
return QVariant(gtkSetting("gtk-icon-theme-name"));
case QPlatformTheme::SystemIconFallbackThemeName: