Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
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 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
91 | | - |
92 | | - |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | | - |
101 | | - |
102 | | - |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | | - |
152 | | - |
153 | | - |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | | - |
164 | | - |
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 | | - |
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}, | - |
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}, | - |
193 | {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, | - |
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}, | - |
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}, | - |
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}, | - |
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}, | - |
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 }, | - |
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}, | - |
283 | {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac}, | - |
284 | {QKeySequence::MoveToEndOfBlock, 1, Qt::ALT | Qt::Key_Down, KB_Mac}, | - |
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}, | - |
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}, | - |
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}, | - |
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 | { } | - |
349 | | - |
350 | QPlatformThemePrivate::~QPlatformThemePrivate() | - |
351 | { | - |
352 | delete systemPalette; | - |
353 | } | - |
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 | } | - |
362 | | - |
363 | QPlatformTheme::QPlatformTheme() | - |
364 | : d_ptr(new QPlatformThemePrivate) | - |
365 | { | - |
366 | | - |
367 | } | - |
368 | | - |
369 | QPlatformTheme::QPlatformTheme(QPlatformThemePrivate *priv) | - |
370 | : d_ptr(priv) | - |
371 | { } | - |
372 | | - |
373 | QPlatformTheme::~QPlatformTheme() | - |
374 | { | - |
375 | | - |
376 | } | - |
377 | | - |
378 | bool QPlatformTheme::usePlatformNativeDialog(DialogType type) const | - |
379 | { | - |
380 | Q_UNUSED(type); | - |
381 | return false; | - |
382 | } | - |
383 | | - |
384 | QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(DialogType type) const | - |
385 | { | - |
386 | Q_UNUSED(type); | - |
387 | return 0; | - |
388 | } | - |
389 | | - |
390 | const QPalette *QPlatformTheme::palette(Palette type) const | - |
391 | { | - |
392 | Q_D(const QPlatformTheme); | - |
393 | if (type == QPlatformTheme::SystemPalette) { | - |
394 | if (!d->systemPalette) | - |
395 | const_cast<QPlatformTheme *>(this)->d_ptr->initializeSystemPalette(); | - |
396 | return d->systemPalette; | - |
397 | } | - |
398 | return 0; | - |
399 | } | - |
400 | | - |
401 | const QFont *QPlatformTheme::font(Font type) const | - |
402 | { | - |
403 | Q_UNUSED(type) | - |
404 | return 0; | - |
405 | } | - |
406 | | - |
407 | QPixmap QPlatformTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const | - |
408 | { | - |
409 | Q_UNUSED(sp); | - |
410 | Q_UNUSED(size); | - |
411 | | - |
412 | return QPixmap(); | - |
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 | | - |
422 | return QPixmap(); | - |
423 | } | - |
424 | | - |
425 | QVariant QPlatformTheme::themeHint(ThemeHint hint) const | - |
426 | { | - |
427 | | - |
428 | | - |
429 | | - |
430 | | - |
431 | switch (hint) { | - |
432 | case QPlatformTheme::CursorFlashTime: | - |
433 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::CursorFlashTime); | - |
434 | case QPlatformTheme::KeyboardInputInterval: | - |
435 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardInputInterval); | - |
436 | case QPlatformTheme::KeyboardAutoRepeatRate: | - |
437 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::KeyboardAutoRepeatRate); | - |
438 | case QPlatformTheme::MouseDoubleClickInterval: | - |
439 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MouseDoubleClickInterval); | - |
440 | case QPlatformTheme::StartDragDistance: | - |
441 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragDistance); | - |
442 | case QPlatformTheme::StartDragTime: | - |
443 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragTime); | - |
444 | case QPlatformTheme::StartDragVelocity: | - |
445 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::StartDragVelocity); | - |
446 | case QPlatformTheme::PasswordMaskDelay: | - |
447 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskDelay); | - |
448 | case QPlatformTheme::PasswordMaskCharacter: | - |
449 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter); | - |
450 | case QPlatformTheme::MousePressAndHoldInterval: | - |
451 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval); | - |
452 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: | - |
453 | return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick); | - |
454 | default: | - |
455 | return QPlatformTheme::defaultThemeHint(hint); | - |
456 | } | - |
457 | } | - |
458 | | - |
459 | QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) | - |
460 | { | - |
461 | switch (hint) { | - |
462 | case QPlatformTheme::CursorFlashTime: | - |
463 | return QVariant(1000); | - |
464 | case QPlatformTheme::KeyboardInputInterval: | - |
465 | return QVariant(400); | - |
466 | case QPlatformTheme::KeyboardAutoRepeatRate: | - |
467 | return QVariant(30); | - |
468 | case QPlatformTheme::MouseDoubleClickInterval: | - |
469 | return QVariant(400); | - |
470 | case QPlatformTheme::StartDragDistance: | - |
471 | return QVariant(10); | - |
472 | case QPlatformTheme::StartDragTime: | - |
473 | return QVariant(500); | - |
474 | case QPlatformTheme::PasswordMaskDelay: | - |
475 | return QVariant(int(0)); | - |
476 | case QPlatformTheme::PasswordMaskCharacter: | - |
477 | return QVariant(QChar(0x25CF)); | - |
478 | case QPlatformTheme::StartDragVelocity: | - |
479 | return QVariant(int(0)); | - |
480 | case QPlatformTheme::UseFullScreenForPopupMenu: | - |
481 | return QVariant(false); | - |
482 | case QPlatformTheme::WindowAutoPlacement: | - |
483 | return QVariant(false); | - |
484 | case QPlatformTheme::DialogButtonBoxLayout: | - |
485 | return QVariant(int(0)); | - |
486 | case QPlatformTheme::DialogButtonBoxButtonsHaveIcons: | - |
487 | return QVariant(false); | - |
488 | case QPlatformTheme::ItemViewActivateItemOnSingleClick: | - |
489 | return QVariant(false); | - |
490 | case QPlatformTheme::ToolButtonStyle: | - |
491 | return QVariant(int(Qt::ToolButtonIconOnly)); | - |
492 | case QPlatformTheme::ToolBarIconSize: | - |
493 | return QVariant(int(0)); | - |
494 | case QPlatformTheme::SystemIconThemeName: | - |
495 | case QPlatformTheme::SystemIconFallbackThemeName: | - |
496 | return QVariant(QString()); | - |
497 | case QPlatformTheme::IconThemeSearchPaths: | - |
498 | return QVariant(QStringList()); | - |
499 | case QPlatformTheme::StyleNames: | - |
500 | return QVariant(QStringList()); | - |
501 | case TextCursorWidth: | - |
502 | return QVariant(1); | - |
503 | case DropShadow: | - |
504 | return QVariant(false); | - |
505 | case MaximumScrollBarDragDistance: | - |
506 | return QVariant(-1); | - |
507 | case KeyboardScheme: | - |
508 | return QVariant(int(WindowsKeyboardScheme)); | - |
509 | case UiEffects: | - |
510 | return QVariant(int(0)); | - |
511 | case SpellCheckUnderlineStyle: | - |
512 | return QVariant(int(QTextCharFormat::SpellCheckUnderline)); | - |
513 | case TabFocusBehavior: | - |
514 | return QVariant(int(Qt::TabFocusAllControls)); | - |
515 | case IconPixmapSizes: | - |
516 | return QVariant::fromValue(QList<int>()); | - |
517 | case DialogSnapToDefaultButton: | - |
518 | case ContextMenuOnMouseRelease: | - |
519 | return QVariant(false); | - |
520 | case MousePressAndHoldInterval: | - |
521 | return QVariant(800); | - |
522 | case MouseDoubleClickDistance: | - |
523 | { | - |
524 | bool ok = false; | - |
525 | const int dist = qEnvironmentVariableIntValue("QT_DBL_CLICK_DIST", &ok); | - |
526 | return QVariant(ok ? dist : 5); | - |
527 | } | - |
528 | case WheelScrollLines: | - |
529 | return QVariant(3); | - |
530 | } | - |
531 | return QVariant(); | - |
532 | } | - |
533 | | - |
534 | QPlatformMenuItem *QPlatformTheme::createPlatformMenuItem() const | - |
535 | { | - |
536 | return 0; | - |
537 | } | - |
538 | | - |
539 | QPlatformMenu *QPlatformTheme::createPlatformMenu() const | - |
540 | { | - |
541 | return 0; | - |
542 | } | - |
543 | | - |
544 | QPlatformMenuBar *QPlatformTheme::createPlatformMenuBar() const | - |
545 | { | - |
546 | return 0; | - |
547 | } | - |
548 | | - |
549 | #ifndef QT_NO_SYSTEMTRAYICON | - |
550 | | - |
551 | | - |
552 | | - |
553 | | - |
554 | QPlatformSystemTrayIcon *QPlatformTheme::createPlatformSystemTrayIcon() const | - |
555 | { | - |
556 | return 0; | - |
557 | } | - |
558 | #endif | - |
559 | | - |
560 | | - |
561 | | - |
562 | | - |
563 | | - |
564 | | - |
565 | | - |
566 | | - |
567 | | - |
568 | | - |
569 | | - |
570 | QIconEngine *QPlatformTheme::createIconEngine(const QString &iconName) const | - |
571 | { | - |
572 | return new QIconLoaderEngine(iconName); | - |
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 | | - |
591 | struct ByStandardKey { | - |
592 | typedef bool result_type; | - |
593 | | - |
594 | bool operator()(QKeySequence::StandardKey lhs, QKeySequence::StandardKey rhs) const | - |
595 | { return lhs < rhs; } | - |
596 | | - |
597 | bool operator()(const QKeyBinding& lhs, const QKeyBinding& rhs) const | - |
598 | { return operator()(lhs.standardKey, rhs.standardKey); } | - |
599 | | - |
600 | bool operator()(QKeySequence::StandardKey lhs, const QKeyBinding& rhs) const | - |
601 | { return operator()(lhs, rhs.standardKey); } | - |
602 | | - |
603 | bool operator()(const QKeyBinding& lhs, QKeySequence::StandardKey rhs) const | - |
604 | { return operator()(lhs.standardKey, rhs); } | - |
605 | }; | - |
606 | | - |
607 | | - |
608 | | - |
609 | | - |
610 | | - |
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) { | - |
623 | if (!(it->platform & platform)) | - |
624 | continue; | - |
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) | - |
633 | list.prepend(QKeySequence(shortcut)); | - |
634 | else | - |
635 | list.append(QKeySequence(shortcut)); | - |
636 | } | - |
637 | | - |
638 | return list; | - |
639 | } | - |
640 | | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | | - |
646 | | - |
647 | | - |
648 | QString QPlatformTheme::standardButtonText(int button) const | - |
649 | { | - |
650 | return QPlatformTheme::defaultStandardButtonText(button); | - |
651 | } | - |
652 | | - |
653 | QString QPlatformTheme::defaultStandardButtonText(int button) | - |
654 | { | - |
655 | switch (button) { | - |
656 | case QPlatformDialogHelper::Ok: | - |
657 | return QCoreApplication::translate("QPlatformTheme", "OK"); | - |
658 | case QPlatformDialogHelper::Save: | - |
659 | return QCoreApplication::translate("QPlatformTheme", "Save"); | - |
660 | case QPlatformDialogHelper::SaveAll: | - |
661 | return QCoreApplication::translate("QPlatformTheme", "Save All"); | - |
662 | case QPlatformDialogHelper::Open: | - |
663 | return QCoreApplication::translate("QPlatformTheme", "Open"); | - |
664 | case QPlatformDialogHelper::Yes: | - |
665 | return QCoreApplication::translate("QPlatformTheme", "&Yes"); | - |
666 | case QPlatformDialogHelper::YesToAll: | - |
667 | return QCoreApplication::translate("QPlatformTheme", "Yes to &All"); | - |
668 | case QPlatformDialogHelper::No: | - |
669 | return QCoreApplication::translate("QPlatformTheme", "&No"); | - |
670 | case QPlatformDialogHelper::NoToAll: | - |
671 | return QCoreApplication::translate("QPlatformTheme", "N&o to All"); | - |
672 | case QPlatformDialogHelper::Abort: | - |
673 | return QCoreApplication::translate("QPlatformTheme", "Abort"); | - |
674 | case QPlatformDialogHelper::Retry: | - |
675 | return QCoreApplication::translate("QPlatformTheme", "Retry"); | - |
676 | case QPlatformDialogHelper::Ignore: | - |
677 | return QCoreApplication::translate("QPlatformTheme", "Ignore"); | - |
678 | case QPlatformDialogHelper::Close: | - |
679 | return QCoreApplication::translate("QPlatformTheme", "Close"); | - |
680 | case QPlatformDialogHelper::Cancel: | - |
681 | return QCoreApplication::translate("QPlatformTheme", "Cancel"); | - |
682 | case QPlatformDialogHelper::Discard: | - |
683 | return QCoreApplication::translate("QPlatformTheme", "Discard"); | - |
684 | case QPlatformDialogHelper::Help: | - |
685 | return QCoreApplication::translate("QPlatformTheme", "Help"); | - |
686 | case QPlatformDialogHelper::Apply: | - |
687 | return QCoreApplication::translate("QPlatformTheme", "Apply"); | - |
688 | case QPlatformDialogHelper::Reset: | - |
689 | return QCoreApplication::translate("QPlatformTheme", "Reset"); | - |
690 | case QPlatformDialogHelper::RestoreDefaults: | - |
691 | return QCoreApplication::translate("QPlatformTheme", "Restore Defaults"); | - |
692 | default: | - |
693 | break; | - |
694 | } | - |
695 | return QString(); | - |
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) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
705 | if (original.at(currPos) == QLatin1Char('&')TRUE | never evaluated | FALSE | never evaluated |
| 0 |
706 | && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
707 | ++currPos; | - |
708 | --l; | - |
709 | if (l == 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
710 | break; never executed: break; | 0 |
711 | } else if (original.at(currPos) == QLatin1Char('(') && l >= 4 && never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
712 | original.at(currPos + 1) == QLatin1Char('&') &&TRUE | never evaluated | FALSE | never evaluated |
| 0 |
713 | original.at(currPos + 2) != QLatin1Char('&') &&TRUE | never evaluated | FALSE | never evaluated |
| 0 |
714 | original.at(currPos + 3) == QLatin1Char(')')) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
715 | | - |
716 | int n = 0; | - |
717 | while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 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 | - |
738 | || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme | - |
739 | || keyboardScheme == QPlatformTheme::CdeKeyboardScheme) | - |
740 | result |= KB_X11; | - |
741 | return result; | - |
742 | } | - |
743 | | - |
744 | QT_END_NAMESPACE | - |
| | |