diff options
-rw-r--r-- | src/plugins/platformthemes/gtk2/qgtk2theme.cpp | 23 | ||||
-rw-r--r-- | src/plugins/platformthemes/gtk2/qgtk2theme.h | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp index 7bb538b888..b26ab94b83 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp @@ -41,6 +41,7 @@ #include "qgtk2theme.h" #include "qgtk2dialoghelpers.h" +#include <QVariant> #undef signals #include <gtk/gtk.h> @@ -49,11 +50,33 @@ QT_BEGIN_NAMESPACE const char *QGtk2Theme::name = "gtk2"; +static QString gtkSetting(const gchar *propertyName) +{ + GtkSettings *settings = gtk_settings_get_default(); + gchararray value; + g_object_get(settings, propertyName, &value, NULL); + QString str = QString::fromUtf8(value); + g_free(value); + return str; +} + QGtk2Theme::QGtk2Theme() { gtk_init(0, 0); } +QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const +{ + switch (hint) { + case QPlatformTheme::SystemIconThemeName: + return QVariant(gtkSetting("gtk-icon-theme-name")); + case QPlatformTheme::SystemIconFallbackThemeName: + return QVariant(gtkSetting("gtk-fallback-icon-theme")); + default: + return QGnomeTheme::themeHint(hint); + } +} + bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const { Q_UNUSED(type); diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.h b/src/plugins/platformthemes/gtk2/qgtk2theme.h index 6d8768dd8e..a351b5b738 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.h +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.h @@ -51,6 +51,8 @@ class QGtk2Theme : public QGnomeTheme public: QGtk2Theme(); + virtual QVariant themeHint(ThemeHint hint) const; + virtual bool usePlatformNativeDialog(DialogType type) const; virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; |