summaryrefslogtreecommitdiff
path: root/src/gui/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-19 15:50:45 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-10-07 10:58:49 +0200
commitee383b89f16a9a75a934076255bddbef5a075fa3 (patch)
tree22118d8368e89aae2ebf09e41b79f3d69d811cae /src/gui/styles/qcommonstyle.cpp
parentc14455b78904f25e724cd928652c49f9583c6aa0 (diff)
downloadqt4-tools-ee383b89f16a9a75a934076255bddbef5a075fa3.tar.gz
Integrate the GuiPlatformPlugin interface
This is an internal interface for plugins that can be provided by the platform to give platform-specific features by platforms built on top of Qt. We can easlily integrate Qt on Windows, Mac, Gnome, ... without any plugin because we can link to their respective library (dynamically if we don't want to depend on it). On Gnome, we can dynamically resolve Gtk+ symbols. This is however not possible for KDE or other platform built on top of Qt: we can't link against their library because they depend on us and we can't dynamically resolve the symbols because they are mangled (C++) So this plugin provides hooks inside Qt to be able to do things like native File or Color dialog, native icons, accurate reading of the config file, and so on. This is currently private API. Task-number: QT-406 Reviewed-by: Jens Bache-Wiig Reviewed-by: Oswald Buddenhagen
Diffstat (limited to 'src/gui/styles/qcommonstyle.cpp')
-rw-r--r--src/gui/styles/qcommonstyle.cpp54
1 files changed, 4 insertions, 50 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index df4f866f24..612258a4bd 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -63,7 +63,6 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qrubberband.h>
-#include <../kernel/qkde_p.h>
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
#include <private/qstylehelper_p.h>
@@ -75,6 +74,7 @@
#include <qdir.h>
#include <qsettings.h>
#include <qpixmapcache.h>
+#include <private/qguiplatformplugin_p.h>
#include <limits.h>
@@ -837,35 +837,6 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
}
#endif // QT_NO_TOOLBUTTON
-
-#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec
-
-/*!internal
-
-Checks if you are running KDE and looks up the toolbar
-from the KDE configuration file
-
-*/
-int QCommonStylePrivate::lookupToolButtonStyle() const
-{
- int result = Qt::ToolButtonIconOnly;
- if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) {
- QSettings settings(QKde::kdeHome() +
- QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- settings.beginGroup(QLatin1String("Toolbar style"));
- QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
- if (toolbarStyle == QLatin1String("TextBesideIcon"))
- result = Qt::ToolButtonTextBesideIcon;
- else if (toolbarStyle == QLatin1String("TextOnly"))
- result = Qt::ToolButtonTextOnly;
- else if (toolbarStyle == QLatin1String("TextUnderIcon"))
- result = Qt::ToolButtonTextUnderIcon;
- }
- return result;
-}
-
-#endif //Q_WS_X11
-
#ifndef QT_NO_ITEMVIEWS
QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const
@@ -4688,19 +4659,8 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_ToolBarIconSize:
-#ifdef Q_WS_X11
- if (X11->desktopVersion >= 4) {
- static int iconSize = 0;
- if (!iconSize) {
- QSettings settings(QKde::kdeHome() +
- QLatin1String("/share/config/kdeglobals"),
- QSettings::IniFormat);
- settings.beginGroup(QLatin1String("ToolbarIcons"));
- iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt();
- }
- ret = iconSize;
- } else
-#endif
+ ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolBarIconSize);
+ if (!ret)
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
@@ -5192,13 +5152,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = true;
break;
case SH_ToolButtonStyle:
- ret = Qt::ToolButtonIconOnly;
-#ifdef Q_WS_X11
- {
- static int buttonStyle = d_func()->lookupToolButtonStyle();
- return buttonStyle;
- }
-#endif
+ ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolButtonStyle);
break;
case SH_RequestSoftwareInputPanel:
ret = RSIP_OnMouseClickAndAlreadyFocused;