1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtGui module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include "qplatformtheme.h"
44 #include <QtCore/QVariant>
45 #include <QtCore/QStringList>
47 #include <qtextformat.h>
57 \brief The QPlatformTheme class allows customizing the UI based on themes.
62 \enum QPlatformTheme::ThemeHint
64 This enum describes the available theme hints.
66 \value CursorFlashTime (int) Cursor flash time in ms, overriding
67 QPlatformIntegration::styleHint.
69 \value KeyboardInputInterval (int) Keyboard input interval in ms, overriding
70 QPlatformIntegration::styleHint.
72 \value MouseDoubleClickInterval (int) Mouse double click interval in ms,
73 overriding QPlatformIntegration::styleHint.
75 \value StartDragDistance (int) Start drag distance,
76 overriding QPlatformIntegration::styleHint.
78 \value StartDragTime (int) Start drag time in ms,,
79 overriding QPlatformIntegration::styleHint.
81 \value KeyboardAutoRepeatRate (int) Keyboard auto repeat rate,
82 overriding QPlatformIntegration::styleHint.
84 \value PasswordMaskDelay (int) Pass word mask delay in ms,,
85 overriding QPlatformIntegration::styleHint.
87 \value StartDragVelocity (int) Velocity of a drag,
88 overriding QPlatformIntegration::styleHint.
90 \value TextCursorWidth (int) Determines the width of the text cursor.
92 \value DropShadow (bool) Determines whether the drop shadow effect for
93 tooltips or whatsthis is enabled.
95 \value MaximumScrollBarDragDistance (int) Determines the value returned by
96 QStyle::pixelMetric(PM_MaximumDragDistance)
98 \value ToolButtonStyle (int) A value representing a Qt::ToolButtonStyle.
100 \value ToolBarIconSize Icon size for tool bars.
102 \value SystemIconThemeName (QString) Name of the icon theme.
104 \value SystemIconFallbackThemeName (QString) Name of the fallback icon theme.
106 \value IconThemeSearchPaths (QStringList) Search paths for icons.
108 \value ItemViewActivateItemOnSingleClick (bool) Activate items by single click.
110 \value StyleNames (QStringList) A list of preferred style names.
112 \value WindowAutoPlacement (bool) A boolean value indicating whether Windows
113 (particularly dialogs) are placed by the system
114 (see _NET_WM_FULL_PLACEMENT in X11).
116 \value DialogButtonBoxLayout (int) An integer representing a
117 QDialogButtonBox::ButtonLayout value.
119 \value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether
120 the buttons of a QDialogButtonBox should have icons.
122 \value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar.
124 \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the
127 \value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations.
129 \value SpellCheckUnderlineStyle (int) A QTextCharFormat::UnderlineStyle specifying
130 the underline style used misspelled words when spell checking.
132 \sa themeHint(), QStyle::pixelMetric()
135 QPlatformTheme::~QPlatformTheme()
140 bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const
146 QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const
152 const QPalette *QPlatformTheme::palette(Palette type) const
158 const QFont *QPlatformTheme::font(Font type) const
164 QVariant QPlatformTheme::themeHint(ThemeHint hint) const
166 return QPlatformTheme::defaultThemeHint(hint);
169 QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
172 case QPlatformTheme::CursorFlashTime:
173 return QVariant(1000);
174 case QPlatformTheme::KeyboardInputInterval:
175 return QVariant(400);
176 case QPlatformTheme::KeyboardAutoRepeatRate:
178 case QPlatformTheme::MouseDoubleClickInterval:
179 return QVariant(400);
180 case QPlatformTheme::StartDragDistance:
182 case QPlatformTheme::StartDragTime:
183 return QVariant(500);
184 case QPlatformTheme::PasswordMaskDelay:
185 return QVariant(int(0));
186 case QPlatformTheme::StartDragVelocity:
187 return QVariant(int(0)); // no limit
188 case QPlatformTheme::UseFullScreenForPopupMenu:
189 return QVariant(false);
190 case QPlatformTheme::WindowAutoPlacement:
191 return QVariant(false);
192 case QPlatformTheme::DialogButtonBoxLayout:
193 return QVariant(int(0));
194 case QPlatformTheme::DialogButtonBoxButtonsHaveIcons:
195 return QVariant(false);
196 case QPlatformTheme::ItemViewActivateItemOnSingleClick:
197 return QVariant(false);
198 case QPlatformTheme::ToolButtonStyle:
199 return QVariant(int(Qt::ToolButtonIconOnly));
200 case QPlatformTheme::ToolBarIconSize:
201 return QVariant(int(0));
202 case QPlatformTheme::SystemIconThemeName:
203 case QPlatformTheme::SystemIconFallbackThemeName:
204 return QVariant(QString());
205 case QPlatformTheme::IconThemeSearchPaths:
206 return QVariant(QStringList());
207 case QPlatformTheme::StyleNames:
208 return QVariant(QStringList());
209 case TextCursorWidth:
212 return QVariant(false);
213 case MaximumScrollBarDragDistance:
216 return QVariant(int(WindowsKeyboardScheme));
218 return QVariant(int(0));
219 case SpellCheckUnderlineStyle:
220 return QVariant(int(QTextCharFormat::SpellCheckUnderline));
225 QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const
230 QPlatformMenu *QPlatformTheme::createPlatformMenu() const
235 QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const
240 #ifndef QT_NO_SYSTEMTRAYICON
242 Factory function for QSystemTrayIcon. This function will return 0 if the platform
243 integration does not support creating any system tray icon.
245 QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const