Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformtheme.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||
2 | ** | - | ||||||||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
5 | ** | - | ||||||||||||
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
7 | ** | - | ||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||
16 | ** | - | ||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
24 | ** | - | ||||||||||||
25 | ** GNU General Public License Usage | - | ||||||||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
35 | ** | - | ||||||||||||
36 | ** $QT_END_LICENSE$ | - | ||||||||||||
37 | ** | - | ||||||||||||
38 | ****************************************************************************/ | - | ||||||||||||
39 | - | |||||||||||||
40 | #include "qplatformtheme.h" | - | ||||||||||||
41 | - | |||||||||||||
42 | #include "qplatformtheme_p.h" | - | ||||||||||||
43 | - | |||||||||||||
44 | #include <QtCore/QVariant> | - | ||||||||||||
45 | #include <QtCore/QStringList> | - | ||||||||||||
46 | #include <QtCore/qfileinfo.h> | - | ||||||||||||
47 | #include <qpalette.h> | - | ||||||||||||
48 | #include <qtextformat.h> | - | ||||||||||||
49 | #include <private/qiconloader_p.h> | - | ||||||||||||
50 | #include <private/qguiapplication_p.h> | - | ||||||||||||
51 | #include <qpa/qplatformintegration.h> | - | ||||||||||||
52 | #include <qpa/qplatformdialoghelper.h> | - | ||||||||||||
53 | - | |||||||||||||
54 | #include <algorithm> | - | ||||||||||||
55 | - | |||||||||||||
56 | QT_BEGIN_NAMESPACE | - | ||||||||||||
57 | - | |||||||||||||
58 | /*! | - | ||||||||||||
59 | \class QPlatformTheme | - | ||||||||||||
60 | \since 5.0 | - | ||||||||||||
61 | \internal | - | ||||||||||||
62 | \preliminary | - | ||||||||||||
63 | \ingroup qpa | - | ||||||||||||
64 | \brief The QPlatformTheme class allows customizing the UI based on themes. | - | ||||||||||||
65 | - | |||||||||||||
66 | */ | - | ||||||||||||
67 | - | |||||||||||||
68 | /*! | - | ||||||||||||
69 | \enum QPlatformTheme::ThemeHint | - | ||||||||||||
70 | - | |||||||||||||
71 | This enum describes the available theme hints. | - | ||||||||||||
72 | - | |||||||||||||
73 | \value CursorFlashTime (int) Cursor flash time in ms, overriding | - | ||||||||||||
74 | QPlatformIntegration::styleHint. | - | ||||||||||||
75 | - | |||||||||||||
76 | \value KeyboardInputInterval (int) Keyboard input interval in ms, overriding | - | ||||||||||||
77 | QPlatformIntegration::styleHint. | - | ||||||||||||
78 | - | |||||||||||||
79 | \value MouseDoubleClickInterval (int) Mouse double click interval in ms, | - | ||||||||||||
80 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
81 | - | |||||||||||||
82 | \value MouseDoubleClickDistance (int) The maximum distance in logical pixels which the mouse can travel | - | ||||||||||||
83 | between clicks in order for the click sequence to be handled as a double click. | - | ||||||||||||
84 | The default value is 5 logical pixels. | - | ||||||||||||
85 | - | |||||||||||||
86 | \value MousePressAndHoldInterval (int) Mouse press and hold interval in ms, | - | ||||||||||||
87 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
88 | - | |||||||||||||
89 | \value StartDragDistance (int) Start drag distance, | - | ||||||||||||
90 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
91 | - | |||||||||||||
92 | \value StartDragTime (int) Start drag time in ms, | - | ||||||||||||
93 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
94 | - | |||||||||||||
95 | \value WheelScrollLines (int) The number of lines to scroll a widget, when the mouse wheel is rotated. | - | ||||||||||||
96 | The default value is 3. \sa QApplication::wheelScrollLines() | - | ||||||||||||
97 | - | |||||||||||||
98 | \value KeyboardAutoRepeatRate (int) Keyboard auto repeat rate, | - | ||||||||||||
99 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
100 | - | |||||||||||||
101 | \value PasswordMaskDelay (int) Pass word mask delay in ms, | - | ||||||||||||
102 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
103 | - | |||||||||||||
104 | \value StartDragVelocity (int) Velocity of a drag, | - | ||||||||||||
105 | overriding QPlatformIntegration::styleHint. | - | ||||||||||||
106 | - | |||||||||||||
107 | \value TextCursorWidth (int) Determines the width of the text cursor. | - | ||||||||||||
108 | - | |||||||||||||
109 | \value DropShadow (bool) Determines whether the drop shadow effect for | - | ||||||||||||
110 | tooltips or whatsthis is enabled. | - | ||||||||||||
111 | - | |||||||||||||
112 | \value MaximumScrollBarDragDistance (int) Determines the value returned by | - | ||||||||||||
113 | QStyle::pixelMetric(PM_MaximumDragDistance) | - | ||||||||||||
114 | - | |||||||||||||
115 | \value ToolButtonStyle (int) A value representing a Qt::ToolButtonStyle. | - | ||||||||||||
116 | - | |||||||||||||
117 | \value ToolBarIconSize Icon size for tool bars. | - | ||||||||||||
118 | - | |||||||||||||
119 | \value SystemIconThemeName (QString) Name of the icon theme. | - | ||||||||||||
120 | - | |||||||||||||
121 | \value SystemIconFallbackThemeName (QString) Name of the fallback icon theme. | - | ||||||||||||
122 | - | |||||||||||||
123 | \value IconThemeSearchPaths (QStringList) Search paths for icons. | - | ||||||||||||
124 | - | |||||||||||||
125 | \value ItemViewActivateItemOnSingleClick (bool) Activate items by single click. | - | ||||||||||||
126 | - | |||||||||||||
127 | \value StyleNames (QStringList) A list of preferred style names. | - | ||||||||||||
128 | - | |||||||||||||
129 | \value WindowAutoPlacement (bool) A boolean value indicating whether Windows | - | ||||||||||||
130 | (particularly dialogs) are placed by the system | - | ||||||||||||
131 | (see _NET_WM_FULL_PLACEMENT in X11). | - | ||||||||||||
132 | - | |||||||||||||
133 | \value DialogButtonBoxLayout (int) An integer representing a | - | ||||||||||||
134 | QDialogButtonBox::ButtonLayout value. | - | ||||||||||||
135 | - | |||||||||||||
136 | \value DialogButtonBoxButtonsHaveIcons (bool) A boolean value indicating whether | - | ||||||||||||
137 | the buttons of a QDialogButtonBox should have icons. | - | ||||||||||||
138 | - | |||||||||||||
139 | \value UseFullScreenForPopupMenu (bool) Pop menus can cover the full screen including task bar. | - | ||||||||||||
140 | - | |||||||||||||
141 | \value KeyboardScheme (int) An integer value (enum KeyboardSchemes) specifying the | - | ||||||||||||
142 | keyboard scheme. | - | ||||||||||||
143 | - | |||||||||||||
144 | \value UiEffects (int) A flag value consisting of UiEffect values specifying the enabled UI animations. | - | ||||||||||||
145 | - | |||||||||||||
146 | \value SpellCheckUnderlineStyle (int) A QTextCharFormat::UnderlineStyle specifying | - | ||||||||||||
147 | the underline style used misspelled words when spell checking. | - | ||||||||||||
148 | - | |||||||||||||
149 | \value TabFocusBehavior (int) A Qt::TabFocusBehavior specifying | - | ||||||||||||
150 | the behavior of focus change when tab key was pressed. | - | ||||||||||||
151 | This enum value was added in Qt 5.5. | - | ||||||||||||
152 | - | |||||||||||||
153 | \value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog | - | ||||||||||||
154 | becomes visible. | - | ||||||||||||
155 | - | |||||||||||||
156 | \value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release. | - | ||||||||||||
157 | - | |||||||||||||
158 | \sa themeHint(), QStyle::pixelMetric() | - | ||||||||||||
159 | */ | - | ||||||||||||
160 | - | |||||||||||||
161 | - | |||||||||||||
162 | // Table of key bindings. It must be sorted on key sequence: | - | ||||||||||||
163 | // The integer value of VK_KEY | Modifier Keys (e.g., VK_META, and etc.) | - | ||||||||||||
164 | // A priority of 1 indicates that this is the primary key binding when multiple are defined. | - | ||||||||||||
165 | - | |||||||||||||
166 | enum KeyPlatform { | - | ||||||||||||
167 | KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme), | - | ||||||||||||
168 | KB_Mac = (1 << QPlatformTheme::MacKeyboardScheme), | - | ||||||||||||
169 | KB_X11 = (1 << QPlatformTheme::X11KeyboardScheme), | - | ||||||||||||
170 | KB_KDE = (1 << QPlatformTheme::KdeKeyboardScheme), | - | ||||||||||||
171 | KB_Gnome = (1 << QPlatformTheme::GnomeKeyboardScheme), | - | ||||||||||||
172 | KB_CDE = (1 << QPlatformTheme::CdeKeyboardScheme), | - | ||||||||||||
173 | KB_All = 0xffff | - | ||||||||||||
174 | }; | - | ||||||||||||
175 | - | |||||||||||||
176 | const QKeyBinding QPlatformThemePrivate::keyBindings[] = { | - | ||||||||||||
177 | // StandardKey Priority Key Sequence Platforms | - | ||||||||||||
178 | {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, KB_Mac}, | - | ||||||||||||
179 | {QKeySequence::HelpContents, 0, Qt::Key_F1, KB_Win | KB_X11}, | - | ||||||||||||
180 | {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, KB_All}, | - | ||||||||||||
181 | {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, KB_All}, | - | ||||||||||||
182 | {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac}, | - | ||||||||||||
183 | {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win}, | - | ||||||||||||
184 | {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, KB_Mac}, | - | ||||||||||||
185 | {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11}, | - | ||||||||||||
186 | {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All}, | - | ||||||||||||
187 | {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All}, | - | ||||||||||||
188 | {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only) | - | ||||||||||||
189 | {QKeySequence::Delete, 1, Qt::Key_Delete, KB_All}, | - | ||||||||||||
190 | {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac}, | - | ||||||||||||
191 | {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All}, | - | ||||||||||||
192 | {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac | - | ||||||||||||
193 | {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards | - | ||||||||||||
194 | {QKeySequence::Cut, 0, Qt::META | Qt::Key_K, KB_Mac}, | - | ||||||||||||
195 | {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win}, | - | ||||||||||||
196 | {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All}, | - | ||||||||||||
197 | {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards | - | ||||||||||||
198 | {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, KB_X11}, | - | ||||||||||||
199 | {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All}, | - | ||||||||||||
200 | {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11}, | - | ||||||||||||
201 | {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards | - | ||||||||||||
202 | {QKeySequence::Paste, 0, Qt::META | Qt::Key_Y, KB_Mac}, | - | ||||||||||||
203 | {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, | - | ||||||||||||
204 | {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All}, | - | ||||||||||||
205 | {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards | - | ||||||||||||
206 | {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,KB_Win}, | - | ||||||||||||
207 | {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Mac}, | - | ||||||||||||
208 | {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Win | KB_X11}, | - | ||||||||||||
209 | {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, KB_Win}, | - | ||||||||||||
210 | {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||||||||
211 | {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, KB_Mac}, | - | ||||||||||||
212 | {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, KB_Mac}, | - | ||||||||||||
213 | {QKeySequence::Back, 0, Qt::Key_Backspace, KB_Win}, | - | ||||||||||||
214 | {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||||||||
215 | {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, KB_Mac}, | - | ||||||||||||
216 | {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, KB_Mac}, | - | ||||||||||||
217 | {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, KB_Win}, | - | ||||||||||||
218 | {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, KB_Gnome | KB_Mac}, | - | ||||||||||||
219 | {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11}, | - | ||||||||||||
220 | {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, KB_All}, | - | ||||||||||||
221 | {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, KB_All}, | - | ||||||||||||
222 | {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, KB_All}, | - | ||||||||||||
223 | {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE}, | - | ||||||||||||
224 | {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, KB_All}, | - | ||||||||||||
225 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win}, | - | ||||||||||||
226 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, KB_Mac}, //different priority from above | - | ||||||||||||
227 | {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, KB_Win | KB_X11}, | - | ||||||||||||
228 | {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, KB_Mac}, | - | ||||||||||||
229 | {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, KB_KDE}, | - | ||||||||||||
230 | {QKeySequence::NextChild, 0, Qt::Key_Forward, KB_All}, | - | ||||||||||||
231 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win}, | - | ||||||||||||
232 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Mac },//different priority from above | - | ||||||||||||
233 | {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Win | KB_X11}, | - | ||||||||||||
234 | {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, KB_Mac}, | - | ||||||||||||
235 | {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, KB_KDE}, | - | ||||||||||||
236 | {QKeySequence::PreviousChild, 0, Qt::Key_Back, KB_All}, | - | ||||||||||||
237 | {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, KB_All}, | - | ||||||||||||
238 | {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, KB_Win}, | - | ||||||||||||
239 | {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, KB_Gnome | KB_Mac}, | - | ||||||||||||
240 | {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win}, | - | ||||||||||||
241 | {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11}, | - | ||||||||||||
242 | {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win}, | - | ||||||||||||
243 | {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac}, | - | ||||||||||||
244 | {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, KB_Win}, | - | ||||||||||||
245 | {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, KB_X11}, | - | ||||||||||||
246 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, KB_KDE}, | - | ||||||||||||
247 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Gnome}, | - | ||||||||||||
248 | {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Win}, | - | ||||||||||||
249 | {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, KB_All}, | - | ||||||||||||
250 | {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All}, | - | ||||||||||||
251 | {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All}, | - | ||||||||||||
252 | {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All}, | - | ||||||||||||
253 | {QKeySequence::MoveToNextChar, 1, Qt::Key_Right, KB_All}, | - | ||||||||||||
254 | {QKeySequence::MoveToNextChar, 0, Qt::META | Qt::Key_F, KB_Mac}, | - | ||||||||||||
255 | {QKeySequence::MoveToPreviousChar, 1, Qt::Key_Left, KB_All}, | - | ||||||||||||
256 | {QKeySequence::MoveToPreviousChar, 0, Qt::META | Qt::Key_B, KB_Mac}, | - | ||||||||||||
257 | {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac}, | - | ||||||||||||
258 | {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||||||||
259 | {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, | - | ||||||||||||
260 | {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||||||||
261 | {QKeySequence::MoveToNextLine, 1, Qt::Key_Down, KB_All}, | - | ||||||||||||
262 | {QKeySequence::MoveToNextLine, 0, Qt::META | Qt::Key_N, KB_Mac}, | - | ||||||||||||
263 | {QKeySequence::MoveToPreviousLine, 1, Qt::Key_Up, KB_All}, | - | ||||||||||||
264 | {QKeySequence::MoveToPreviousLine, 0, Qt::META | Qt::Key_P, KB_Mac}, | - | ||||||||||||
265 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac}, | - | ||||||||||||
266 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac}, | - | ||||||||||||
267 | {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_V, KB_Mac}, | - | ||||||||||||
268 | {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac }, | - | ||||||||||||
269 | {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All}, | - | ||||||||||||
270 | {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac}, | - | ||||||||||||
271 | {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, KB_Mac}, | - | ||||||||||||
272 | {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, KB_Mac }, | - | ||||||||||||
273 | {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, KB_All}, | - | ||||||||||||
274 | {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, KB_Mac}, | - | ||||||||||||
275 | {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, KB_Mac }, | - | ||||||||||||
276 | {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||||||||
277 | {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac}, | - | ||||||||||||
278 | {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac }, | - | ||||||||||||
279 | {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11}, | - | ||||||||||||
280 | {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL + Qt::Key_E, KB_X11}, | - | ||||||||||||
281 | {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac}, | - | ||||||||||||
282 | {QKeySequence::MoveToStartOfBlock, 1, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only | - | ||||||||||||
283 | {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac}, | - | ||||||||||||
284 | {QKeySequence::MoveToEndOfBlock, 1, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only | - | ||||||||||||
285 | {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac}, | - | ||||||||||||
286 | {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||||||||
287 | {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac}, | - | ||||||||||||
288 | {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, KB_Mac}, | - | ||||||||||||
289 | {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||||||||
290 | {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, KB_Mac}, | - | ||||||||||||
291 | {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, KB_All}, | - | ||||||||||||
292 | {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, KB_All}, | - | ||||||||||||
293 | {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, KB_Mac}, | - | ||||||||||||
294 | {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Win | KB_X11}, | - | ||||||||||||
295 | {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, KB_Mac}, | - | ||||||||||||
296 | {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Win | KB_X11}, | - | ||||||||||||
297 | {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, KB_All}, | - | ||||||||||||
298 | {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, KB_All}, | - | ||||||||||||
299 | {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, KB_All}, | - | ||||||||||||
300 | {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, KB_All}, | - | ||||||||||||
301 | {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac}, | - | ||||||||||||
302 | {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Mac }, | - | ||||||||||||
303 | {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||||||||
304 | {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, | - | ||||||||||||
305 | {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac }, | - | ||||||||||||
306 | {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||||||||
307 | {QKeySequence::SelectStartOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only | - | ||||||||||||
308 | {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, | - | ||||||||||||
309 | {QKeySequence::SelectEndOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only | - | ||||||||||||
310 | {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, | - | ||||||||||||
311 | {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac}, | - | ||||||||||||
312 | {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, | - | ||||||||||||
313 | {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac}, | - | ||||||||||||
314 | {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, KB_Mac}, | - | ||||||||||||
315 | {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, | - | ||||||||||||
316 | {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, KB_Mac}, | - | ||||||||||||
317 | {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac}, | - | ||||||||||||
318 | {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, KB_X11 | KB_Win}, | - | ||||||||||||
319 | {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac}, | - | ||||||||||||
320 | {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, KB_X11 | KB_Win}, | - | ||||||||||||
321 | {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, KB_X11}, //emacs (line edit only) | - | ||||||||||||
322 | {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, KB_All}, | - | ||||||||||||
323 | {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, KB_All}, | - | ||||||||||||
324 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, KB_Mac}, | - | ||||||||||||
325 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac}, | - | ||||||||||||
326 | {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All}, | - | ||||||||||||
327 | {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All}, | - | ||||||||||||
328 | {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac}, | - | ||||||||||||
329 | {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac}, | - | ||||||||||||
330 | {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac}, | - | ||||||||||||
331 | {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_X11 | KB_Gnome | KB_KDE | KB_Mac}, | - | ||||||||||||
332 | {QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac}, | - | ||||||||||||
333 | {QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win}, | - | ||||||||||||
334 | {QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE}, | - | ||||||||||||
335 | {QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome}, | - | ||||||||||||
336 | {QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE}, | - | ||||||||||||
337 | {QKeySequence::Deselect, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_A, KB_X11}, | - | ||||||||||||
338 | {QKeySequence::DeleteCompleteLine, 0, Qt::CTRL | Qt::Key_U, KB_X11}, | - | ||||||||||||
339 | {QKeySequence::Backspace, 0, Qt::META | Qt::Key_H, KB_Mac}, | - | ||||||||||||
340 | {QKeySequence::Cancel, 0, Qt::Key_Escape, KB_All}, | - | ||||||||||||
341 | {QKeySequence::Cancel, 0, Qt::CTRL | Qt::Key_Period, KB_Mac} | - | ||||||||||||
342 | }; | - | ||||||||||||
343 | - | |||||||||||||
344 | const uint QPlatformThemePrivate::numberOfKeyBindings = sizeof(QPlatformThemePrivate::keyBindings)/(sizeof(QKeyBinding)); | - | ||||||||||||
345 | - | |||||||||||||
346 | QPlatformThemePrivate::QPlatformThemePrivate() | - | ||||||||||||
347 | : systemPalette(0) | - | ||||||||||||
348 | { never executed: }end of block never executed: end of block | 0 | ||||||||||||
349 | - | |||||||||||||
350 | QPlatformThemePrivate::~QPlatformThemePrivate() | - | ||||||||||||
351 | { | - | ||||||||||||
352 | delete systemPalette; | - | ||||||||||||
353 | } never executed: end of block | 0 | ||||||||||||
354 | - | |||||||||||||
355 | Q_GUI_EXPORT QPalette qt_fusionPalette(); | - | ||||||||||||
356 | - | |||||||||||||
357 | void QPlatformThemePrivate::initializeSystemPalette() | - | ||||||||||||
358 | { | - | ||||||||||||
359 | Q_ASSERT(!systemPalette); | - | ||||||||||||
360 | systemPalette = new QPalette(qt_fusionPalette()); | - | ||||||||||||
361 | } never executed: end of block | 0 | ||||||||||||
362 | - | |||||||||||||
363 | QPlatformTheme::QPlatformTheme() | - | ||||||||||||
364 | : d_ptr(new QPlatformThemePrivate) | - | ||||||||||||
365 | { | - | ||||||||||||
366 | - | |||||||||||||
367 | } never executed: end of block | 0 | ||||||||||||
368 | - | |||||||||||||
369 | QPlatformTheme::QPlatformTheme(QPlatformThemePrivate *priv) | - | ||||||||||||
370 | : d_ptr(priv) | - | ||||||||||||
371 | { never executed: }end of block never executed: end of block | 0 | ||||||||||||
372 | - | |||||||||||||
373 | QPlatformTheme::~QPlatformTheme() | - | ||||||||||||
374 | { | - | ||||||||||||
375 | - | |||||||||||||
376 | } | - | ||||||||||||
377 | - | |||||||||||||
378 | bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const | - | ||||||||||||
379 | { | - | ||||||||||||
380 | Q_UNUSED(type); | - | ||||||||||||
381 | return false; never executed: return false; | 0 | ||||||||||||
382 | } | - | ||||||||||||
383 | - | |||||||||||||
384 | QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const | - | ||||||||||||
385 | { | - | ||||||||||||
386 | Q_UNUSED(type); | - | ||||||||||||
387 | return 0; never executed: return 0; | 0 | ||||||||||||
388 | } | - | ||||||||||||
389 | - | |||||||||||||
390 | const QPalette *QPlatformTheme::palette(Palette type) const | - | ||||||||||||
391 | { | - | ||||||||||||
392 | Q_D(const QPlatformTheme); | - | ||||||||||||
393 | if (type == QPlatformTheme::SystemPalette) {
| 0 | ||||||||||||
394 | if (!d->systemPalette)
| 0 | ||||||||||||
395 | const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); never executed: const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); | 0 | ||||||||||||
396 | return d->systemPalette; never executed: return d->systemPalette; | 0 | ||||||||||||
397 | } | - | ||||||||||||
398 | return 0; never executed: return 0; | 0 | ||||||||||||
399 | } | - | ||||||||||||
400 | - | |||||||||||||
401 | const QFont *QPlatformTheme::font(Font type) const | - | ||||||||||||
402 | { | - | ||||||||||||
403 | Q_UNUSED(type) | - | ||||||||||||
404 | return 0; never executed: return 0; | 0 | ||||||||||||
405 | } | - | ||||||||||||
406 | - | |||||||||||||
407 | QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const | - | ||||||||||||
408 | { | - | ||||||||||||
409 | Q_UNUSED(sp); | - | ||||||||||||
410 | Q_UNUSED(size); | - | ||||||||||||
411 | // TODO Should return QCommonStyle pixmaps? | - | ||||||||||||
412 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||
413 | } | - | ||||||||||||
414 | - | |||||||||||||
415 | QPixmap QPlatformTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, | - | ||||||||||||
416 | QPlatformTheme::IconOptions iconOptions) const | - | ||||||||||||
417 | { | - | ||||||||||||
418 | Q_UNUSED(fileInfo); | - | ||||||||||||
419 | Q_UNUSED(size); | - | ||||||||||||
420 | Q_UNUSED(iconOptions); | - | ||||||||||||
421 | // TODO Should return QCommonStyle pixmaps? | - | ||||||||||||
422 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||
423 | } | - | ||||||||||||
424 | - | |||||||||||||
425 | QVariant QPlatformTheme::themeHint(ThemeHint hint) const | - | ||||||||||||
426 | { | - | ||||||||||||
427 | // For theme hints which mirror platform integration style hints, query | - | ||||||||||||
428 | // the platform integration. The base QPlatformIntegration::styleHint() | - | ||||||||||||
429 | // function will in turn query QPlatformTheme::defaultThemeHint() if there | - | ||||||||||||
430 | // is no custom value. | - | ||||||||||||
431 | switch (hint) { | - | ||||||||||||
432 | case QPlatformTheme::CursorFlashTime: never executed: case QPlatformTheme::CursorFlashTime: | 0 | ||||||||||||
433 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); | 0 | ||||||||||||
434 | case QPlatformTheme::KeyboardInputInterval: never executed: case QPlatformTheme::KeyboardInputInterval: | 0 | ||||||||||||
435 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); | 0 | ||||||||||||
436 | case QPlatformTheme::KeyboardAutoRepeatRate: never executed: case QPlatformTheme::KeyboardAutoRepeatRate: | 0 | ||||||||||||
437 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); | 0 | ||||||||||||
438 | case QPlatformTheme::MouseDoubleClickInterval: never executed: case QPlatformTheme::MouseDoubleClickInterval: | 0 | ||||||||||||
439 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); | 0 | ||||||||||||
440 | case QPlatformTheme::StartDragDistance: never executed: case QPlatformTheme::StartDragDistance: | 0 | ||||||||||||
441 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); | 0 | ||||||||||||
442 | case QPlatformTheme::StartDragTime: never executed: case QPlatformTheme::StartDragTime: | 0 | ||||||||||||
443 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); | 0 | ||||||||||||
444 | case QPlatformTheme::StartDragVelocity: never executed: case QPlatformTheme::StartDragVelocity: | 0 | ||||||||||||
445 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); | 0 | ||||||||||||
446 | case QPlatformTheme::PasswordMaskDelay: never executed: case QPlatformTheme::PasswordMaskDelay: | 0 | ||||||||||||
447 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); | 0 | ||||||||||||
448 | case QPlatformTheme::PasswordMaskCharacter: never executed: case QPlatformTheme::PasswordMaskCharacter: | 0 | ||||||||||||
449 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); | 0 | ||||||||||||
450 | case QPlatformTheme::MousePressAndHoldInterval: never executed: case QPlatformTheme::MousePressAndHoldInterval: | 0 | ||||||||||||
451 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); | 0 | ||||||||||||
452 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick: | 0 | ||||||||||||
453 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); never executed: return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); | 0 | ||||||||||||
454 | default: never executed: default: | 0 | ||||||||||||
455 | return QPlatformTheme::defaultThemeHint(hint); never executed: return QPlatformTheme::defaultThemeHint(hint); | 0 | ||||||||||||
456 | } | - | ||||||||||||
457 | } | - | ||||||||||||
458 | - | |||||||||||||
459 | QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) | - | ||||||||||||
460 | { | - | ||||||||||||
461 | switch (hint) { | - | ||||||||||||
462 | case QPlatformTheme::CursorFlashTime: never executed: case QPlatformTheme::CursorFlashTime: | 0 | ||||||||||||
463 | return QVariant(1000); never executed: return QVariant(1000); | 0 | ||||||||||||
464 | case QPlatformTheme::KeyboardInputInterval: never executed: case QPlatformTheme::KeyboardInputInterval: | 0 | ||||||||||||
465 | return QVariant(400); never executed: return QVariant(400); | 0 | ||||||||||||
466 | case QPlatformTheme::KeyboardAutoRepeatRate: never executed: case QPlatformTheme::KeyboardAutoRepeatRate: | 0 | ||||||||||||
467 | return QVariant(30); never executed: return QVariant(30); | 0 | ||||||||||||
468 | case QPlatformTheme::MouseDoubleClickInterval: never executed: case QPlatformTheme::MouseDoubleClickInterval: | 0 | ||||||||||||
469 | return QVariant(400); never executed: return QVariant(400); | 0 | ||||||||||||
470 | case QPlatformTheme::StartDragDistance: never executed: case QPlatformTheme::StartDragDistance: | 0 | ||||||||||||
471 | return QVariant(10); never executed: return QVariant(10); | 0 | ||||||||||||
472 | case QPlatformTheme::StartDragTime: never executed: case QPlatformTheme::StartDragTime: | 0 | ||||||||||||
473 | return QVariant(500); never executed: return QVariant(500); | 0 | ||||||||||||
474 | case QPlatformTheme::PasswordMaskDelay: never executed: case QPlatformTheme::PasswordMaskDelay: | 0 | ||||||||||||
475 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||||||||
476 | case QPlatformTheme::PasswordMaskCharacter: never executed: case QPlatformTheme::PasswordMaskCharacter: | 0 | ||||||||||||
477 | return QVariant(QChar(0x25CF)); never executed: return QVariant(QChar(0x25CF)); | 0 | ||||||||||||
478 | case QPlatformTheme::StartDragVelocity: never executed: case QPlatformTheme::StartDragVelocity: | 0 | ||||||||||||
479 | return QVariant(int(0)); // no limit never executed: return QVariant(int(0)); | 0 | ||||||||||||
480 | case QPlatformTheme::UseFullScreenForPopupMenu: never executed: case QPlatformTheme::UseFullScreenForPopupMenu: | 0 | ||||||||||||
481 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
482 | case QPlatformTheme::WindowAutoPlacement: never executed: case QPlatformTheme::WindowAutoPlacement: | 0 | ||||||||||||
483 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
484 | case QPlatformTheme::DialogButtonBoxLayout: never executed: case QPlatformTheme::DialogButtonBoxLayout: | 0 | ||||||||||||
485 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||||||||
486 | case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: never executed: case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: | 0 | ||||||||||||
487 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
488 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: never executed: case QPlatformTheme::ItemViewActivateItemOnSingleClick: | 0 | ||||||||||||
489 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
490 | case QPlatformTheme::ToolButtonStyle: never executed: case QPlatformTheme::ToolButtonStyle: | 0 | ||||||||||||
491 | return QVariant(int(Qt::ToolButtonIconOnly)); never executed: return QVariant(int(Qt::ToolButtonIconOnly)); | 0 | ||||||||||||
492 | case QPlatformTheme::ToolBarIconSize: never executed: case QPlatformTheme::ToolBarIconSize: | 0 | ||||||||||||
493 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||||||||
494 | case QPlatformTheme::SystemIconThemeName: never executed: case QPlatformTheme::SystemIconThemeName: | 0 | ||||||||||||
495 | case QPlatformTheme::SystemIconFallbackThemeName: never executed: case QPlatformTheme::SystemIconFallbackThemeName: | 0 | ||||||||||||
496 | return QVariant(QString()); never executed: return QVariant(QString()); | 0 | ||||||||||||
497 | case QPlatformTheme::IconThemeSearchPaths: never executed: case QPlatformTheme::IconThemeSearchPaths: | 0 | ||||||||||||
498 | return QVariant(QStringList()); never executed: return QVariant(QStringList()); | 0 | ||||||||||||
499 | case QPlatformTheme::StyleNames: never executed: case QPlatformTheme::StyleNames: | 0 | ||||||||||||
500 | return QVariant(QStringList()); never executed: return QVariant(QStringList()); | 0 | ||||||||||||
501 | case TextCursorWidth: never executed: case TextCursorWidth: | 0 | ||||||||||||
502 | return QVariant(1); never executed: return QVariant(1); | 0 | ||||||||||||
503 | case DropShadow: never executed: case DropShadow: | 0 | ||||||||||||
504 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
505 | case MaximumScrollBarDragDistance: never executed: case MaximumScrollBarDragDistance: | 0 | ||||||||||||
506 | return QVariant(-1); never executed: return QVariant(-1); | 0 | ||||||||||||
507 | case KeyboardScheme: never executed: case KeyboardScheme: | 0 | ||||||||||||
508 | return QVariant(int(WindowsKeyboardScheme)); never executed: return QVariant(int(WindowsKeyboardScheme)); | 0 | ||||||||||||
509 | case UiEffects: never executed: case UiEffects: | 0 | ||||||||||||
510 | return QVariant(int(0)); never executed: return QVariant(int(0)); | 0 | ||||||||||||
511 | case SpellCheckUnderlineStyle: never executed: case SpellCheckUnderlineStyle: | 0 | ||||||||||||
512 | return QVariant(int(QTextCharFormat::SpellCheckUnderline)); never executed: return QVariant(int(QTextCharFormat::SpellCheckUnderline)); | 0 | ||||||||||||
513 | case TabFocusBehavior: never executed: case TabFocusBehavior: | 0 | ||||||||||||
514 | return QVariant(int(Qt::TabFocusAllControls)); never executed: return QVariant(int(Qt::TabFocusAllControls)); | 0 | ||||||||||||
515 | case IconPixmapSizes: never executed: case IconPixmapSizes: | 0 | ||||||||||||
516 | return QVariant::fromValue(QList<int>()); never executed: return QVariant::fromValue(QList<int>()); | 0 | ||||||||||||
517 | case DialogSnapToDefaultButton: never executed: case DialogSnapToDefaultButton: | 0 | ||||||||||||
518 | case ContextMenuOnMouseRelease: never executed: case ContextMenuOnMouseRelease: | 0 | ||||||||||||
519 | return QVariant(false); never executed: return QVariant(false); | 0 | ||||||||||||
520 | case MousePressAndHoldInterval: never executed: case MousePressAndHoldInterval: | 0 | ||||||||||||
521 | return QVariant(800); never executed: return QVariant(800); | 0 | ||||||||||||
522 | case MouseDoubleClickDistance: never executed: case MouseDoubleClickDistance: | 0 | ||||||||||||
523 | { | - | ||||||||||||
524 | bool ok = false; | - | ||||||||||||
525 | const int dist = qEnvironmentVariableIntValue("QT_DBL_CLICK_DIST", &ok); | - | ||||||||||||
526 | return QVariant(ok ? dist : 5); never executed: return QVariant(ok ? dist : 5); | 0 | ||||||||||||
527 | } | - | ||||||||||||
528 | case WheelScrollLines: never executed: case WheelScrollLines: | 0 | ||||||||||||
529 | return QVariant(3); never executed: return QVariant(3); | 0 | ||||||||||||
530 | } | - | ||||||||||||
531 | return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||
532 | } | - | ||||||||||||
533 | - | |||||||||||||
534 | QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const | - | ||||||||||||
535 | { | - | ||||||||||||
536 | return 0; never executed: return 0; | 0 | ||||||||||||
537 | } | - | ||||||||||||
538 | - | |||||||||||||
539 | QPlatformMenu *QPlatformTheme::createPlatformMenu() const | - | ||||||||||||
540 | { | - | ||||||||||||
541 | return 0; never executed: return 0; | 0 | ||||||||||||
542 | } | - | ||||||||||||
543 | - | |||||||||||||
544 | QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const | - | ||||||||||||
545 | { | - | ||||||||||||
546 | return 0; never executed: return 0; | 0 | ||||||||||||
547 | } | - | ||||||||||||
548 | - | |||||||||||||
549 | #ifndef QT_NO_SYSTEMTRAYICON | - | ||||||||||||
550 | /*! | - | ||||||||||||
551 | Factory function for QSystemTrayIcon. This function will return 0 if the platform | - | ||||||||||||
552 | integration does not support creating any system tray icon. | - | ||||||||||||
553 | */ | - | ||||||||||||
554 | QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const | - | ||||||||||||
555 | { | - | ||||||||||||
556 | return 0; never executed: return 0; | 0 | ||||||||||||
557 | } | - | ||||||||||||
558 | #endif | - | ||||||||||||
559 | - | |||||||||||||
560 | /*! | - | ||||||||||||
561 | Factory function for the QIconEngine used by QIcon::fromTheme(). By default this | - | ||||||||||||
562 | function returns a QIconLoaderEngine, but subclasses can reimplement it to | - | ||||||||||||
563 | provide their own. | - | ||||||||||||
564 | - | |||||||||||||
565 | It is especially useful to benefit from some platform specific facilities or | - | ||||||||||||
566 | optimizations like an inter-process cache in systems mostly built with Qt. | - | ||||||||||||
567 | - | |||||||||||||
568 | \since 5.1 | - | ||||||||||||
569 | */ | - | ||||||||||||
570 | QIconEngine *QPlatformTheme::createIconEngine(const QString &iconName) const | - | ||||||||||||
571 | { | - | ||||||||||||
572 | return new QIconLoaderEngine(iconName); never executed: return new QIconLoaderEngine(iconName); | 0 | ||||||||||||
573 | } | - | ||||||||||||
574 | - | |||||||||||||
575 | #if defined(Q_OS_MACX) | - | ||||||||||||
576 | static inline int maybeSwapShortcut(int shortcut) | - | ||||||||||||
577 | { | - | ||||||||||||
578 | if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { | - | ||||||||||||
579 | uint oldshortcut = shortcut; | - | ||||||||||||
580 | shortcut &= ~(Qt::CTRL | Qt::META); | - | ||||||||||||
581 | if (oldshortcut & Qt::CTRL) | - | ||||||||||||
582 | shortcut |= Qt::META; | - | ||||||||||||
583 | if (oldshortcut & Qt::META) | - | ||||||||||||
584 | shortcut |= Qt::CTRL; | - | ||||||||||||
585 | } | - | ||||||||||||
586 | return shortcut; | - | ||||||||||||
587 | } | - | ||||||||||||
588 | #endif | - | ||||||||||||
589 | - | |||||||||||||
590 | // mixed-mode predicate: all of these overloads are actually needed (but not all for every compiler) | - | ||||||||||||
591 | struct ByStandardKey { | - | ||||||||||||
592 | typedef bool result_type; | - | ||||||||||||
593 | - | |||||||||||||
594 | bool operator()(QKeySequence::StandardKey lhs, QKeySequence::StandardKey rhs) const | - | ||||||||||||
595 | { return lhs < rhs; } never executed: return lhs < rhs; | 0 | ||||||||||||
596 | - | |||||||||||||
597 | bool operator()(const QKeyBinding& lhs, const QKeyBinding& rhs) const | - | ||||||||||||
598 | { return operator()(lhs.standardKey, rhs.standardKey); } never executed: return operator()(lhs.standardKey, rhs.standardKey); | 0 | ||||||||||||
599 | - | |||||||||||||
600 | bool operator()(QKeySequence::StandardKey lhs, const QKeyBinding& rhs) const | - | ||||||||||||
601 | { return operator()(lhs, rhs.standardKey); } never executed: return operator()(lhs, rhs.standardKey); | 0 | ||||||||||||
602 | - | |||||||||||||
603 | bool operator()(const QKeyBinding& lhs, QKeySequence::StandardKey rhs) const | - | ||||||||||||
604 | { return operator()(lhs.standardKey, rhs); } never executed: return operator()(lhs.standardKey, rhs); | 0 | ||||||||||||
605 | }; | - | ||||||||||||
606 | - | |||||||||||||
607 | /*! | - | ||||||||||||
608 | Returns the key sequence that should be used for a standard action. | - | ||||||||||||
609 | - | |||||||||||||
610 | \since 5.2 | - | ||||||||||||
611 | */ | - | ||||||||||||
612 | QList<QKeySequence> QPlatformTheme::keyBindings(QKeySequence::StandardKey key) const | - | ||||||||||||
613 | { | - | ||||||||||||
614 | const uint platform = QPlatformThemePrivate::currentKeyPlatforms(); | - | ||||||||||||
615 | QList <QKeySequence> list; | - | ||||||||||||
616 | - | |||||||||||||
617 | std::pair<const QKeyBinding *, const QKeyBinding *> range = | - | ||||||||||||
618 | std::equal_range(QPlatformThemePrivate::keyBindings, | - | ||||||||||||
619 | QPlatformThemePrivate::keyBindings + QPlatformThemePrivate::numberOfKeyBindings, | - | ||||||||||||
620 | key, ByStandardKey()); | - | ||||||||||||
621 | - | |||||||||||||
622 | for (const QKeyBinding *it = range.first; it < range.second; ++it) {
| 0 | ||||||||||||
623 | if (!(it->platform & platform))
| 0 | ||||||||||||
624 | continue; never executed: continue; | 0 | ||||||||||||
625 | - | |||||||||||||
626 | uint shortcut = | - | ||||||||||||
627 | #if defined(Q_OS_MACX) | - | ||||||||||||
628 | maybeSwapShortcut(it->shortcut); | - | ||||||||||||
629 | #else | - | ||||||||||||
630 | it->shortcut; | - | ||||||||||||
631 | #endif | - | ||||||||||||
632 | if (it->priority > 0)
| 0 | ||||||||||||
633 | list.prepend(QKeySequence(shortcut)); never executed: list.prepend(QKeySequence(shortcut)); | 0 | ||||||||||||
634 | else | - | ||||||||||||
635 | list.append(QKeySequence(shortcut)); never executed: list.append(QKeySequence(shortcut)); | 0 | ||||||||||||
636 | } | - | ||||||||||||
637 | - | |||||||||||||
638 | return list; never executed: return list; | 0 | ||||||||||||
639 | } | - | ||||||||||||
640 | - | |||||||||||||
641 | /*! | - | ||||||||||||
642 | Returns the text of a standard \a button. | - | ||||||||||||
643 | - | |||||||||||||
644 | \since 5.3 | - | ||||||||||||
645 | \sa QPlatformDialogHelper::StandardButton | - | ||||||||||||
646 | */ | - | ||||||||||||
647 | - | |||||||||||||
648 | QString QPlatformTheme::standardButtonText(int button) const | - | ||||||||||||
649 | { | - | ||||||||||||
650 | return QPlatformTheme::defaultStandardButtonText(button); never executed: return QPlatformTheme::defaultStandardButtonText(button); | 0 | ||||||||||||
651 | } | - | ||||||||||||
652 | - | |||||||||||||
653 | QString QPlatformTheme::defaultStandardButtonText(int button) | - | ||||||||||||
654 | { | - | ||||||||||||
655 | switch (button) { | - | ||||||||||||
656 | case QPlatformDialogHelper::Ok: never executed: case QPlatformDialogHelper::Ok: | 0 | ||||||||||||
657 | return QCoreApplication::translate("QPlatformTheme", "OK"); never executed: return QCoreApplication::translate("QPlatformTheme", "OK"); | 0 | ||||||||||||
658 | case QPlatformDialogHelper::Save: never executed: case QPlatformDialogHelper::Save: | 0 | ||||||||||||
659 | return QCoreApplication::translate("QPlatformTheme", "Save"); never executed: return QCoreApplication::translate("QPlatformTheme", "Save"); | 0 | ||||||||||||
660 | case QPlatformDialogHelper::SaveAll: never executed: case QPlatformDialogHelper::SaveAll: | 0 | ||||||||||||
661 | return QCoreApplication::translate("QPlatformTheme", "Save All"); never executed: return QCoreApplication::translate("QPlatformTheme", "Save All"); | 0 | ||||||||||||
662 | case QPlatformDialogHelper::Open: never executed: case QPlatformDialogHelper::Open: | 0 | ||||||||||||
663 | return QCoreApplication::translate("QPlatformTheme", "Open"); never executed: return QCoreApplication::translate("QPlatformTheme", "Open"); | 0 | ||||||||||||
664 | case QPlatformDialogHelper::Yes: never executed: case QPlatformDialogHelper::Yes: | 0 | ||||||||||||
665 | return QCoreApplication::translate("QPlatformTheme", "&Yes"); never executed: return QCoreApplication::translate("QPlatformTheme", "&Yes"); | 0 | ||||||||||||
666 | case QPlatformDialogHelper::YesToAll: never executed: case QPlatformDialogHelper::YesToAll: | 0 | ||||||||||||
667 | return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); never executed: return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); | 0 | ||||||||||||
668 | case QPlatformDialogHelper::No: never executed: case QPlatformDialogHelper::No: | 0 | ||||||||||||
669 | return QCoreApplication::translate("QPlatformTheme", "&No"); never executed: return QCoreApplication::translate("QPlatformTheme", "&No"); | 0 | ||||||||||||
670 | case QPlatformDialogHelper::NoToAll: never executed: case QPlatformDialogHelper::NoToAll: | 0 | ||||||||||||
671 | return QCoreApplication::translate("QPlatformTheme", "N&o to All"); never executed: return QCoreApplication::translate("QPlatformTheme", "N&o to All"); | 0 | ||||||||||||
672 | case QPlatformDialogHelper::Abort: never executed: case QPlatformDialogHelper::Abort: | 0 | ||||||||||||
673 | return QCoreApplication::translate("QPlatformTheme", "Abort"); never executed: return QCoreApplication::translate("QPlatformTheme", "Abort"); | 0 | ||||||||||||
674 | case QPlatformDialogHelper::Retry: never executed: case QPlatformDialogHelper::Retry: | 0 | ||||||||||||
675 | return QCoreApplication::translate("QPlatformTheme", "Retry"); never executed: return QCoreApplication::translate("QPlatformTheme", "Retry"); | 0 | ||||||||||||
676 | case QPlatformDialogHelper::Ignore: never executed: case QPlatformDialogHelper::Ignore: | 0 | ||||||||||||
677 | return QCoreApplication::translate("QPlatformTheme", "Ignore"); never executed: return QCoreApplication::translate("QPlatformTheme", "Ignore"); | 0 | ||||||||||||
678 | case QPlatformDialogHelper::Close: never executed: case QPlatformDialogHelper::Close: | 0 | ||||||||||||
679 | return QCoreApplication::translate("QPlatformTheme", "Close"); never executed: return QCoreApplication::translate("QPlatformTheme", "Close"); | 0 | ||||||||||||
680 | case QPlatformDialogHelper::Cancel: never executed: case QPlatformDialogHelper::Cancel: | 0 | ||||||||||||
681 | return QCoreApplication::translate("QPlatformTheme", "Cancel"); never executed: return QCoreApplication::translate("QPlatformTheme", "Cancel"); | 0 | ||||||||||||
682 | case QPlatformDialogHelper::Discard: never executed: case QPlatformDialogHelper::Discard: | 0 | ||||||||||||
683 | return QCoreApplication::translate("QPlatformTheme", "Discard"); never executed: return QCoreApplication::translate("QPlatformTheme", "Discard"); | 0 | ||||||||||||
684 | case QPlatformDialogHelper::Help: never executed: case QPlatformDialogHelper::Help: | 0 | ||||||||||||
685 | return QCoreApplication::translate("QPlatformTheme", "Help"); never executed: return QCoreApplication::translate("QPlatformTheme", "Help"); | 0 | ||||||||||||
686 | case QPlatformDialogHelper::Apply: never executed: case QPlatformDialogHelper::Apply: | 0 | ||||||||||||
687 | return QCoreApplication::translate("QPlatformTheme", "Apply"); never executed: return QCoreApplication::translate("QPlatformTheme", "Apply"); | 0 | ||||||||||||
688 | case QPlatformDialogHelper::Reset: never executed: case QPlatformDialogHelper::Reset: | 0 | ||||||||||||
689 | return QCoreApplication::translate("QPlatformTheme", "Reset"); never executed: return QCoreApplication::translate("QPlatformTheme", "Reset"); | 0 | ||||||||||||
690 | case QPlatformDialogHelper::RestoreDefaults: never executed: case QPlatformDialogHelper::RestoreDefaults: | 0 | ||||||||||||
691 | return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); never executed: return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); | 0 | ||||||||||||
692 | default: never executed: default: | 0 | ||||||||||||
693 | break; never executed: break; | 0 | ||||||||||||
694 | } | - | ||||||||||||
695 | return QString(); never executed: return QString(); | 0 | ||||||||||||
696 | } | - | ||||||||||||
697 | - | |||||||||||||
698 | QString QPlatformTheme::removeMnemonics(const QString &original) | - | ||||||||||||
699 | { | - | ||||||||||||
700 | QString returnText(original.size(), 0); | - | ||||||||||||
701 | int finalDest = 0; | - | ||||||||||||
702 | int currPos = 0; | - | ||||||||||||
703 | int l = original.length(); | - | ||||||||||||
704 | while (l) {
| 0 | ||||||||||||
705 | if (original.at(currPos) == QLatin1Char('&')
| 0 | ||||||||||||
706 | && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
| 0 | ||||||||||||
707 | ++currPos; | - | ||||||||||||
708 | --l; | - | ||||||||||||
709 | if (l == 0)
| 0 | ||||||||||||
710 | break; never executed: break; | 0 | ||||||||||||
711 | } else if (original.at(currPos) == QLatin1Char('(') && l >= 4 && never executed: end of block
| 0 | ||||||||||||
712 | original.at(currPos + 1) == QLatin1Char('&') &&
| 0 | ||||||||||||
713 | original.at(currPos + 2) != QLatin1Char('&') &&
| 0 | ||||||||||||
714 | original.at(currPos + 3) == QLatin1Char(')')) {
| 0 | ||||||||||||
715 | /* remove mnemonics its format is "\s*(&X)" */ | - | ||||||||||||
716 | int n = 0; | - | ||||||||||||
717 | while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
| 0 | ||||||||||||
718 | ++n; never executed: ++n; | 0 | ||||||||||||
719 | finalDest -= n; | - | ||||||||||||
720 | currPos += 4; | - | ||||||||||||
721 | l -= 4; | - | ||||||||||||
722 | continue; never executed: continue; | 0 | ||||||||||||
723 | } | - | ||||||||||||
724 | returnText[finalDest] = original.at(currPos); | - | ||||||||||||
725 | ++currPos; | - | ||||||||||||
726 | ++finalDest; | - | ||||||||||||
727 | --l; | - | ||||||||||||
728 | } never executed: end of block | 0 | ||||||||||||
729 | returnText.truncate(finalDest); | - | ||||||||||||
730 | return returnText; never executed: return returnText; | 0 | ||||||||||||
731 | } | - | ||||||||||||
732 | - | |||||||||||||
733 | unsigned QPlatformThemePrivate::currentKeyPlatforms() | - | ||||||||||||
734 | { | - | ||||||||||||
735 | const uint keyboardScheme = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::KeyboardScheme).toInt(); | - | ||||||||||||
736 | unsigned result = 1u << keyboardScheme; | - | ||||||||||||
737 | if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
| 0 | ||||||||||||
738 | || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
| 0 | ||||||||||||
739 | || keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
| 0 | ||||||||||||
740 | result |= KB_X11; never executed: result |= KB_X11; | 0 | ||||||||||||
741 | return result; never executed: return result; | 0 | ||||||||||||
742 | } | - | ||||||||||||
743 | - | |||||||||||||
744 | QT_END_NAMESPACE | - | ||||||||||||
Source code | Switch to Preprocessed file |