From 4cf0deef73ff2f24a80622ec5f391d10c74ea6c7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Feb 2012 17:17:36 +0100 Subject: Add palette() and further hints to QtGui/QPlatformTheme. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move palette() from deprecated QtWidgets/QGuiPlatformPlugin to QtGui/QPlatformTheme, Make it return a const * since QPalette does not have isNull(). - Initialize QGuiApplication::palette() and QApplication::systemPalette() from it. - Do not initialize QPalette from QGuiApplication::palette() unless app_pal is non-null (default to Qt::black if it is 0). This avoids initialization order crashes/recursions in the QPA plugin. Streamline initialization function. - Remove styleName(), systemIconThemeName() and iconSearchPaths() from QGuiPlatformPlugin and re-add them as QPlatformTheme::themeHint(). - Remove styleHint() from QGuiPlatformPlugin, add it to QPlatformTheme::themeHint(). - Add UNIX themes with factory function (Generic, KDE, Gnome), taking it from Qt 4.8 code (stripping the KDE 3 code). - Implement Windows palettes. Task-number: QTBUG-24204 Change-Id: Ie27ec035df4f84c42deaffc4816b2e53ce705462 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qplatformtheme_qpa.cpp | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/gui/kernel/qplatformtheme_qpa.cpp') diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp index d2ff804ddf..aec465f0ff 100644 --- a/src/gui/kernel/qplatformtheme_qpa.cpp +++ b/src/gui/kernel/qplatformtheme_qpa.cpp @@ -42,6 +42,8 @@ #include "qplatformtheme_qpa.h" #include +#include +#include QT_BEGIN_NAMESPACE @@ -68,6 +70,21 @@ QT_BEGIN_NAMESPACE \value MaximumScrollBarDragDistance (int) Determines the value returned by QStyle::pixelMetric(PM_MaximumDragDistance) + \value ToolButtonStyle (int) A value representing a Qt::ToolButtonStyle. + + \value ToolBarIconSize Icon size for tool bars. + + \value SystemIconThemeName (QString) Name of the icon theme. + + \value SystemIconFallbackThemeName (QString) Name of the fallback icon theme. + + \value IconThemeSearchPaths (QStringList) Search paths for icons. + + \value ItemViewActivateItemOnSingleClick (bool) Activate items by single click. + + \value StyleNames (QStringList) A list of preferred style names. + + \sa themeHint(), QStyle::pixelMetric() */ @@ -95,9 +112,28 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType typ return 0; } +const QPalette *QPlatformTheme::palette(Palette type) const +{ + Q_UNUSED(type) + return 0; +} + QVariant QPlatformTheme::themeHint(ThemeHint hint) const { switch (hint) { + case QPlatformTheme::ItemViewActivateItemOnSingleClick: + return QVariant(false); + case QPlatformTheme::ToolButtonStyle: + return QVariant(int(Qt::ToolButtonIconOnly)); + case QPlatformTheme::ToolBarIconSize: + return QVariant(int(0)); + case QPlatformTheme::SystemIconThemeName: + case QPlatformTheme::SystemIconFallbackThemeName: + return QVariant(QString()); + case QPlatformTheme::IconThemeSearchPaths: + return QVariant(QStringList()); + case QPlatformTheme::StyleNames: + return QVariant(QStringList()); case TextCursorWidth: return QVariant(1); case DropShadow: -- cgit v1.2.3