kernel/qkeysequence.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10 -
11 -
12 -
13 -
14 -
15static bool qt_sequence_no_mnemonics = false; -
16 -
17void __attribute__((visibility("default"))) qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemonics = !b; }
never executed: }
0
18static const struct { -
19 int key; -
20 const char* name; -
21} keyname[] = { -
22 -
23 -
24 -
25 { Qt::Key_Space, "Space" }, -
26 { Qt::Key_Escape, "Esc" }, -
27 { Qt::Key_Tab, "Tab" }, -
28 { Qt::Key_Backtab, "Backtab" }, -
29 { Qt::Key_Backspace, "Backspace" }, -
30 { Qt::Key_Return, "Return" }, -
31 { Qt::Key_Enter, "Enter" }, -
32 { Qt::Key_Insert, "Ins" }, -
33 { Qt::Key_Delete, "Del" }, -
34 { Qt::Key_Pause, "Pause" }, -
35 { Qt::Key_Print, "Print" }, -
36 { Qt::Key_SysReq, "SysReq" }, -
37 { Qt::Key_Home, "Home" }, -
38 { Qt::Key_End, "End" }, -
39 { Qt::Key_Left, "Left" }, -
40 { Qt::Key_Up, "Up" }, -
41 { Qt::Key_Right, "Right" }, -
42 { Qt::Key_Down, "Down" }, -
43 { Qt::Key_PageUp, "PgUp" }, -
44 { Qt::Key_PageDown, "PgDown" }, -
45 { Qt::Key_CapsLock, "CapsLock" }, -
46 { Qt::Key_NumLock, "NumLock" }, -
47 { Qt::Key_ScrollLock, "ScrollLock" }, -
48 { Qt::Key_Menu, "Menu" }, -
49 { Qt::Key_Help, "Help" }, -
50 -
51 -
52 -
53 -
54 { Qt::Key_Back, "Back" }, -
55 { Qt::Key_Forward, "Forward" }, -
56 { Qt::Key_Stop, "Stop" }, -
57 { Qt::Key_Refresh, "Refresh" }, -
58 { Qt::Key_VolumeDown, "Volume Down" }, -
59 { Qt::Key_VolumeMute, "Volume Mute" }, -
60 { Qt::Key_VolumeUp, "Volume Up" }, -
61 { Qt::Key_BassBoost, "Bass Boost" }, -
62 { Qt::Key_BassUp, "Bass Up" }, -
63 { Qt::Key_BassDown, "Bass Down" }, -
64 { Qt::Key_TrebleUp, "Treble Up" }, -
65 { Qt::Key_TrebleDown, "Treble Down" }, -
66 { Qt::Key_MediaPlay, "Media Play" }, -
67 { Qt::Key_MediaStop, "Media Stop" }, -
68 { Qt::Key_MediaPrevious, "Media Previous" }, -
69 { Qt::Key_MediaNext, "Media Next" }, -
70 { Qt::Key_MediaRecord, "Media Record" }, -
71 -
72 { Qt::Key_MediaPause, "Media Pause" }, -
73 -
74 { Qt::Key_MediaTogglePlayPause, "Toggle Media Play/Pause" }, -
75 { Qt::Key_HomePage, "Home Page" }, -
76 { Qt::Key_Favorites, "Favorites" }, -
77 { Qt::Key_Search, "Search" }, -
78 { Qt::Key_Standby, "Standby" }, -
79 { Qt::Key_OpenUrl, "Open URL" }, -
80 { Qt::Key_LaunchMail, "Launch Mail" }, -
81 { Qt::Key_LaunchMedia, "Launch Media" }, -
82 { Qt::Key_Launch0, "Launch (0)" }, -
83 { Qt::Key_Launch1, "Launch (1)" }, -
84 { Qt::Key_Launch2, "Launch (2)" }, -
85 { Qt::Key_Launch3, "Launch (3)" }, -
86 { Qt::Key_Launch4, "Launch (4)" }, -
87 { Qt::Key_Launch5, "Launch (5)" }, -
88 { Qt::Key_Launch6, "Launch (6)" }, -
89 { Qt::Key_Launch7, "Launch (7)" }, -
90 { Qt::Key_Launch8, "Launch (8)" }, -
91 { Qt::Key_Launch9, "Launch (9)" }, -
92 { Qt::Key_LaunchA, "Launch (A)" }, -
93 { Qt::Key_LaunchB, "Launch (B)" }, -
94 { Qt::Key_LaunchC, "Launch (C)" }, -
95 { Qt::Key_LaunchD, "Launch (D)" }, -
96 { Qt::Key_LaunchE, "Launch (E)" }, -
97 { Qt::Key_LaunchF, "Launch (F)" }, -
98 { Qt::Key_MonBrightnessUp, "Monitor Brightness Up" }, -
99 { Qt::Key_MonBrightnessDown, "Monitor Brightness Down" }, -
100 { Qt::Key_KeyboardLightOnOff, "Keyboard Light On/Off" }, -
101 { Qt::Key_KeyboardBrightnessUp, "Keyboard Brightness Up" }, -
102 { Qt::Key_KeyboardBrightnessDown, "Keyboard Brightness Down" }, -
103 { Qt::Key_PowerOff, "Power Off" }, -
104 { Qt::Key_WakeUp, "Wake Up" }, -
105 { Qt::Key_Eject, "Eject" }, -
106 { Qt::Key_ScreenSaver, "Screensaver" }, -
107 { Qt::Key_WWW, "WWW" }, -
108 { Qt::Key_Sleep, "Sleep" }, -
109 { Qt::Key_LightBulb, "LightBulb" }, -
110 { Qt::Key_Shop, "Shop" }, -
111 { Qt::Key_History, "History" }, -
112 { Qt::Key_AddFavorite, "Add Favorite" }, -
113 { Qt::Key_HotLinks, "Hot Links" }, -
114 { Qt::Key_BrightnessAdjust, "Adjust Brightness" }, -
115 { Qt::Key_Finance, "Finance" }, -
116 { Qt::Key_Community, "Community" }, -
117 { Qt::Key_AudioRewind, "Audio Rewind" }, -
118 { Qt::Key_BackForward, "Back Forward" }, -
119 { Qt::Key_ApplicationLeft, "Application Left" }, -
120 { Qt::Key_ApplicationRight, "Application Right" }, -
121 { Qt::Key_Book, "Book" }, -
122 { Qt::Key_CD, "CD" }, -
123 { Qt::Key_Calculator, "Calculator" }, -
124 { Qt::Key_Clear, "Clear" }, -
125 { Qt::Key_ClearGrab, "Clear Grab" }, -
126 { Qt::Key_Close, "Close" }, -
127 { Qt::Key_Copy, "Copy" }, -
128 { Qt::Key_Cut, "Cut" }, -
129 { Qt::Key_Display, "Display" }, -
130 { Qt::Key_DOS, "DOS" }, -
131 { Qt::Key_Documents, "Documents" }, -
132 { Qt::Key_Excel, "Spreadsheet" }, -
133 { Qt::Key_Explorer, "Browser" }, -
134 { Qt::Key_Game, "Game" }, -
135 { Qt::Key_Go, "Go" }, -
136 { Qt::Key_iTouch, "iTouch" }, -
137 { Qt::Key_LogOff, "Logoff" }, -
138 { Qt::Key_Market, "Market" }, -
139 { Qt::Key_Meeting, "Meeting" }, -
140 { Qt::Key_MenuKB, "Keyboard Menu" }, -
141 { Qt::Key_MenuPB, "Menu PB" }, -
142 { Qt::Key_MySites, "My Sites" }, -
143 { Qt::Key_News, "News" }, -
144 { Qt::Key_OfficeHome, "Home Office" }, -
145 { Qt::Key_Option, "Option" }, -
146 { Qt::Key_Paste, "Paste" }, -
147 { Qt::Key_Phone, "Phone" }, -
148 { Qt::Key_Reply, "Reply" }, -
149 { Qt::Key_Reload, "Reload" }, -
150 { Qt::Key_RotateWindows, "Rotate Windows" }, -
151 { Qt::Key_RotationPB, "Rotation PB" }, -
152 { Qt::Key_RotationKB, "Rotation KB" }, -
153 { Qt::Key_Save, "Save" }, -
154 { Qt::Key_Send, "Send" }, -
155 { Qt::Key_Spell, "Spellchecker" }, -
156 { Qt::Key_SplitScreen, "Split Screen" }, -
157 { Qt::Key_Support, "Support" }, -
158 { Qt::Key_TaskPane, "Task Panel" }, -
159 { Qt::Key_Terminal, "Terminal" }, -
160 { Qt::Key_Tools, "Tools" }, -
161 { Qt::Key_Travel, "Travel" }, -
162 { Qt::Key_Video, "Video" }, -
163 { Qt::Key_Word, "Word Processor" }, -
164 { Qt::Key_Xfer, "XFer" }, -
165 { Qt::Key_ZoomIn, "Zoom In" }, -
166 { Qt::Key_ZoomOut, "Zoom Out" }, -
167 { Qt::Key_Away, "Away" }, -
168 { Qt::Key_Messenger, "Messenger" }, -
169 { Qt::Key_WebCam, "WebCam" }, -
170 { Qt::Key_MailForward, "Mail Forward" }, -
171 { Qt::Key_Pictures, "Pictures" }, -
172 { Qt::Key_Music, "Music" }, -
173 { Qt::Key_Battery, "Battery" }, -
174 { Qt::Key_Bluetooth, "Bluetooth" }, -
175 { Qt::Key_WLAN, "Wireless" }, -
176 { Qt::Key_UWB, "Ultra Wide Band" }, -
177 { Qt::Key_AudioForward, "Audio Forward" }, -
178 { Qt::Key_AudioRepeat, "Audio Repeat" }, -
179 { Qt::Key_AudioRandomPlay, "Audio Random Play" }, -
180 { Qt::Key_Subtitle, "Subtitle" }, -
181 { Qt::Key_AudioCycleTrack, "Audio Cycle Track" }, -
182 { Qt::Key_Time, "Time" }, -
183 { Qt::Key_Select, "Select" }, -
184 { Qt::Key_View, "View" }, -
185 { Qt::Key_TopMenu, "Top Menu" }, -
186 { Qt::Key_Suspend, "Suspend" }, -
187 { Qt::Key_Hibernate, "Hibernate" }, -
188 -
189 -
190 -
191 { Qt::Key_Print, "Print Screen" }, -
192 { Qt::Key_PageUp, "Page Up" }, -
193 { Qt::Key_PageDown, "Page Down" }, -
194 { Qt::Key_CapsLock, "Caps Lock" }, -
195 { Qt::Key_NumLock, "Num Lock" }, -
196 { Qt::Key_NumLock, "Number Lock" }, -
197 { Qt::Key_ScrollLock, "Scroll Lock" }, -
198 { Qt::Key_Insert, "Insert" }, -
199 { Qt::Key_Delete, "Delete" }, -
200 { Qt::Key_Escape, "Escape" }, -
201 { Qt::Key_SysReq, "System Request" }, -
202 -
203 -
204 -
205 { Qt::Key_Select, "Select" }, -
206 { Qt::Key_Yes, "Yes" }, -
207 { Qt::Key_No, "No" }, -
208 -
209 -
210 -
211 { Qt::Key_Context1, "Context1" }, -
212 { Qt::Key_Context2, "Context2" }, -
213 { Qt::Key_Context3, "Context3" }, -
214 { Qt::Key_Context4, "Context4" }, -
215 -
216 { Qt::Key_Call, "Call" }, -
217 -
218 { Qt::Key_Hangup, "Hangup" }, -
219 -
220 { Qt::Key_ToggleCallHangup, "Toggle Call/Hangup" }, -
221 { Qt::Key_Flip, "Flip" }, -
222 -
223 { Qt::Key_VoiceDial, "Voice Dial" }, -
224 -
225 { Qt::Key_LastNumberRedial, "Last Number Redial" }, -
226 -
227 { Qt::Key_Camera, "Camera Shutter" }, -
228 -
229 { Qt::Key_CameraFocus, "Camera Focus" }, -
230 -
231 -
232 -
233 { Qt::Key_Kanji, "Kanji" }, -
234 { Qt::Key_Muhenkan, "Muhenkan" }, -
235 { Qt::Key_Henkan, "Henkan" }, -
236 { Qt::Key_Romaji, "Romaji" }, -
237 { Qt::Key_Hiragana, "Hiragana" }, -
238 { Qt::Key_Katakana, "Katakana" }, -
239 { Qt::Key_Hiragana_Katakana,"Hiragana Katakana" }, -
240 { Qt::Key_Zenkaku, "Zenkaku" }, -
241 { Qt::Key_Hankaku, "Hankaku" }, -
242 { Qt::Key_Zenkaku_Hankaku, "Zenkaku Hankaku" }, -
243 { Qt::Key_Touroku, "Touroku" }, -
244 { Qt::Key_Massyo, "Massyo" }, -
245 { Qt::Key_Kana_Lock, "Kana Lock" }, -
246 { Qt::Key_Kana_Shift, "Kana Shift" }, -
247 { Qt::Key_Eisu_Shift, "Eisu Shift" }, -
248 { Qt::Key_Eisu_toggle, "Eisu toggle" }, -
249 { Qt::Key_Codeinput, "Code input" }, -
250 { Qt::Key_MultipleCandidate,"Multiple Candidate" }, -
251 { Qt::Key_PreviousCandidate,"Previous Candidate" }, -
252 -
253 -
254 -
255 { Qt::Key_Hangul, "Hangul" }, -
256 { Qt::Key_Hangul_Start, "Hangul Start" }, -
257 { Qt::Key_Hangul_End, "Hangul End" }, -
258 { Qt::Key_Hangul_Hanja, "Hangul Hanja" }, -
259 { Qt::Key_Hangul_Jamo, "Hangul Jamo" }, -
260 { Qt::Key_Hangul_Romaja, "Hangul Romaja" }, -
261 { Qt::Key_Hangul_Jeonja, "Hangul Jeonja" }, -
262 { Qt::Key_Hangul_Banja, "Hangul Banja" }, -
263 { Qt::Key_Hangul_PreHanja, "Hangul PreHanja" }, -
264 { Qt::Key_Hangul_PostHanja,"Hangul PostHanja" }, -
265 { Qt::Key_Hangul_Special, "Hangul Special" }, -
266 -
267 { 0, 0 } -
268}; -
269 -
270 -
271 -
272 -
273 -
274enum KeyPlatform { -
275 KB_Win = (1 << QPlatformTheme::WindowsKeyboardScheme), -
276 KB_Mac = (1 << QPlatformTheme::MacKeyboardScheme), -
277 KB_X11 = (1 << QPlatformTheme::X11KeyboardScheme), -
278 KB_KDE = (1 << QPlatformTheme::KdeKeyboardScheme), -
279 KB_Gnome = (1 << QPlatformTheme::GnomeKeyboardScheme), -
280 KB_CDE = (1 << QPlatformTheme::CdeKeyboardScheme), -
281 KB_All = 0xffff -
282}; -
283 -
284const QKeyBinding QKeySequencePrivate::keyBindings[] = { -
285 -
286 {QKeySequence::Back, 0, Qt::Key_Backspace, KB_Win}, -
287 {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Return, KB_All}, -
288 {QKeySequence::InsertParagraphSeparator,0, Qt::Key_Enter, KB_All}, -
289 {QKeySequence::Delete, 1, Qt::Key_Delete, KB_All}, -
290 {QKeySequence::MoveToStartOfLine, 0, Qt::Key_Home, KB_Win | KB_X11}, -
291 {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac}, -
292 {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11}, -
293 {QKeySequence::MoveToEndOfDocument, 0, Qt::Key_End, KB_Mac}, -
294 {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, KB_All}, -
295 {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, KB_All}, -
296 {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, KB_All}, -
297 {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, KB_All}, -
298 {QKeySequence::MoveToPreviousPage, 1, Qt::Key_PageUp, KB_All}, -
299 {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All}, -
300 {QKeySequence::HelpContents, 0, Qt::Key_F1, KB_Win | KB_X11}, -
301 {QKeySequence::FindNext, 0, Qt::Key_F3, KB_X11}, -
302 {QKeySequence::FindNext, 1, Qt::Key_F3, KB_Win}, -
303 {QKeySequence::Refresh, 0, Qt::Key_F5, KB_Win | KB_X11}, -
304 {QKeySequence::FullScreen, 1, Qt::Key_F11, KB_Win | KB_KDE}, -
305 {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, -
306 {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, -
307 {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, -
308 {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, -
309 {QKeySequence::PreviousChild, 0, Qt::Key_Back, KB_All}, -
310 {QKeySequence::NextChild, 0, Qt::Key_Forward, KB_All}, -
311 {QKeySequence::Forward, 0, Qt::SHIFT | Qt::Key_Backspace, KB_Win}, -
312 {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All}, -
313 {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All}, -
314 {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11}, -
315 {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, -
316 {QKeySequence::SelectStartOfLine, 0, Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, -
317 {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac}, -
318 {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, -
319 {QKeySequence::SelectEndOfDocument, 0, Qt::SHIFT | Qt::Key_End, KB_Mac}, -
320 {QKeySequence::SelectPreviousChar, 0, Qt::SHIFT | Qt::Key_Left, KB_All}, -
321 {QKeySequence::SelectPreviousLine, 0, Qt::SHIFT | Qt::Key_Up, KB_All}, -
322 {QKeySequence::SelectNextChar, 0, Qt::SHIFT | Qt::Key_Right, KB_All}, -
323 {QKeySequence::SelectNextLine, 0, Qt::SHIFT | Qt::Key_Down, KB_All}, -
324 {QKeySequence::SelectPreviousPage, 0, Qt::SHIFT | Qt::Key_PageUp, KB_All}, -
325 {QKeySequence::SelectNextPage, 0, Qt::SHIFT | Qt::Key_PageDown, KB_All}, -
326 {QKeySequence::WhatsThis, 1, Qt::SHIFT | Qt::Key_F1, KB_All}, -
327 {QKeySequence::FindPrevious, 0, Qt::SHIFT | Qt::Key_F3, KB_X11}, -
328 {QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, KB_Win}, -
329 {QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, KB_All}, -
330 {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, KB_KDE}, -
331 {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac}, -
332 {QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, KB_All}, -
333 {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, KB_KDE}, -
334 {QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, KB_Mac}, -
335 {QKeySequence::SelectAll, 1, Qt::CTRL | Qt::Key_A, KB_All}, -
336 {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All}, -
337 {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All}, -
338 {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, -
339 {QKeySequence::Find, 0, Qt::CTRL | Qt::Key_F, KB_All}, -
340 {QKeySequence::FindNext, 1, Qt::CTRL | Qt::Key_G, KB_Gnome | KB_Mac}, -
341 {QKeySequence::FindNext, 0, Qt::CTRL | Qt::Key_G, KB_Win}, -
342 {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Win}, -
343 {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_H, KB_Gnome}, -
344 {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All}, -
345 {QKeySequence::DeleteEndOfLine, 0, Qt::CTRL | Qt::Key_K, KB_X11}, -
346 {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All}, -
347 {QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, KB_All}, -
348 {QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, KB_All}, -
349 {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac}, -
350 {QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, KB_Gnome | KB_Mac}, -
351 {QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, KB_KDE}, -
352 {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All}, -
353 {QKeySequence::AddTab, 0, Qt::CTRL | Qt::Key_T, KB_All}, -
354 {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All}, -
355 {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All}, -
356 {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11}, -
357 {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_W, KB_Mac}, -
358 {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All}, -
359 {QKeySequence::Redo, 1, Qt::CTRL | Qt::Key_Y, KB_Win}, -
360 {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All}, -
361 {QKeySequence::Back, 1, Qt::CTRL | Qt::Key_BracketLeft, KB_Mac}, -
362 {QKeySequence::Forward, 1, Qt::CTRL | Qt::Key_BracketRight, KB_Mac}, -
363 {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::Key_BraceLeft, KB_Mac}, -
364 {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_BraceRight, KB_Mac}, -
365 {QKeySequence::NextChild, 1, Qt::CTRL | Qt::Key_Tab, KB_Win | KB_X11}, -
366 {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Tab, KB_Mac}, -
367 {QKeySequence::DeleteStartOfWord, 0, Qt::CTRL | Qt::Key_Backspace, KB_X11 | KB_Win}, -
368 {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win}, -
369 {QKeySequence::DeleteEndOfWord, 0, Qt::CTRL | Qt::Key_Delete, KB_X11 | KB_Win}, -
370 {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11}, -
371 {QKeySequence::MoveToEndOfDocument, 0, Qt::CTRL | Qt::Key_End, KB_Win | KB_X11}, -
372 {QKeySequence::Back, 0, Qt::CTRL | Qt::Key_Left, KB_Mac}, -
373 {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11}, -
374 {QKeySequence::MoveToStartOfLine, 0, Qt::CTRL | Qt::Key_Left, KB_Mac }, -
375 {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac}, -
376 {QKeySequence::Forward, 0, Qt::CTRL | Qt::Key_Right, KB_Mac}, -
377 {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL | Qt::Key_Right, KB_Mac }, -
378 {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11}, -
379 {QKeySequence::MoveToEndOfDocument, 1, Qt::CTRL | Qt::Key_Down, KB_Mac}, -
380 {QKeySequence::Close, 1, Qt::CTRL | Qt::Key_F4, KB_Win}, -
381 {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_F4, KB_Mac}, -
382 {QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_F6, KB_Win}, -
383 {QKeySequence::FullScreen, 1, Qt::CTRL | Qt::Key_F11, KB_Gnome}, -
384 {QKeySequence::FullScreen, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F, KB_KDE}, -
385 {QKeySequence::FindPrevious, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Gnome | KB_Mac}, -
386 {QKeySequence::FindPrevious, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_G, KB_Win}, -
387 {QKeySequence::AddTab, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_N, KB_KDE}, -
388 {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac}, -
389 {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Win | KB_X11}, -
390 {QKeySequence::Redo, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Z, KB_Mac}, -
391 {QKeySequence::PreviousChild, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Win | KB_X11}, -
392 {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Backtab, KB_Mac }, -
393 {QKeySequence::Paste, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Insert, KB_X11}, -
394 {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, -
395 {QKeySequence::SelectEndOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, -
396 {QKeySequence::SelectPreviousWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Win | KB_X11}, -
397 {QKeySequence::SelectStartOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Left, KB_Mac }, -
398 {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac}, -
399 {QKeySequence::SelectNextWord, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Win | KB_X11}, -
400 {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac }, -
401 {QKeySequence::SelectEndOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Down, KB_Mac}, -
402 {QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_F6, KB_Win}, -
403 {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, -
404 {QKeySequence::DeleteStartOfWord, 0, Qt::ALT | Qt::Key_Backspace, KB_Mac}, -
405 {QKeySequence::FullScreen, 0, Qt::ALT | Qt::Key_Enter, KB_Win}, -
406 {QKeySequence::DeleteEndOfWord, 0, Qt::ALT | Qt::Key_Delete, KB_Mac}, -
407 {QKeySequence::Back, 1, Qt::ALT | Qt::Key_Left, KB_Win | KB_X11}, -
408 {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, -
409 {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, KB_Mac}, -
410 {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac}, -
411 {QKeySequence::Forward, 1, Qt::ALT | Qt::Key_Right, KB_Win | KB_X11}, -
412 {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, KB_Mac}, -
413 {QKeySequence::MoveToPreviousPage, 0, Qt::ALT | Qt::Key_PageUp, KB_Mac }, -
414 {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac }, -
415 {QKeySequence::Redo, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Backspace,KB_Win}, -
416 {QKeySequence::SelectPreviousWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Left, KB_Mac}, -
417 {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, -
418 {QKeySequence::SelectNextWord, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Right, KB_Mac}, -
419 {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, -
420 {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac}, -
421 {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac}, -
422 {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac}, -
423 {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac}, -
424 {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Enter, KB_Mac}, -
425 {QKeySequence::MoveToStartOfLine, 0, Qt::META | Qt::Key_Left, KB_Mac}, -
426 {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_Up, KB_Mac}, -
427 {QKeySequence::MoveToEndOfLine, 0, Qt::META | Qt::Key_Right, KB_Mac}, -
428 {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac}, -
429 {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac}, -
430 {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac}, -
431 {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, -
432 {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, -
433 {QKeySequence::SelectStartOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Left, KB_Mac}, -
434 {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, -
435 {QKeySequence::FullScreen, 1, Qt::META | Qt::CTRL | Qt::Key_F, KB_Mac} -
436}; -
437 -
438const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate::keyBindings)/(sizeof(QKeyBinding)); -
439QKeySequence::QKeySequence(StandardKey key) -
440{ -
441 const QList <QKeySequence> bindings = keyBindings(key); -
442 -
443 if (bindings.size() > 0) {
evaluated: bindings.size() > 0
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:2
2-55
444 d = bindings.first().d; -
445 d->ref.ref(); -
446 }
executed: }
Execution Count:55
55
447 else -
448 d = new QKeySequencePrivate();
executed: d = new QKeySequencePrivate();
Execution Count:2
2
449} -
450 -
451 -
452 -
453 -
454 -
455QKeySequence::QKeySequence() -
456{ -
457 static QKeySequencePrivate shared_empty; -
458 d = &shared_empty; -
459 d->ref.ref(); -
460}
executed: }
Execution Count:15485
15485
461QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format) -
462{ -
463 d = new QKeySequencePrivate(); -
464 assign(key, format); -
465}
executed: }
Execution Count:664
664
466QKeySequence::QKeySequence(int k1, int k2, int k3, int k4) -
467{ -
468 d = new QKeySequencePrivate(); -
469 d->key[0] = k1; -
470 d->key[1] = k2; -
471 d->key[2] = k3; -
472 d->key[3] = k4; -
473}
executed: }
Execution Count:3534
3534
474 -
475 -
476 -
477 -
478QKeySequence::QKeySequence(const QKeySequence& keysequence) -
479 : d(keysequence.d) -
480{ -
481 d->ref.ref(); -
482}
executed: }
Execution Count:10987
10987
483QList<QKeySequence> QKeySequence::keyBindings(StandardKey key) -
484{ -
485 const uint platform = QKeySequencePrivate::currentKeyPlatforms(); -
486 QList <QKeySequence> list; -
487 for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) {
evaluated: i < QKeySequencePrivate::numberOfKeyBindings
TRUEFALSE
yes
Evaluation Count:24150
yes
Evaluation Count:161
161-24150
488 QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i]; -
489 if (keyBinding.standardKey == key && (keyBinding.platform & platform)) {
evaluated: keyBinding.standardKey == key
TRUEFALSE
yes
Evaluation Count:567
yes
Evaluation Count:23583
evaluated: (keyBinding.platform & platform)
TRUEFALSE
yes
Evaluation Count:211
yes
Evaluation Count:356
211-23583
490 uint shortcut = -
491 -
492 -
493 -
494 QKeySequencePrivate::keyBindings[i].shortcut; -
495 -
496 if (keyBinding.priority > 0)
evaluated: keyBinding.priority > 0
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:167
44-167
497 list.prepend(QKeySequence(shortcut));
executed: list.prepend(QKeySequence(shortcut));
Execution Count:44
44
498 else -
499 list.append(QKeySequence(shortcut));
executed: list.append(QKeySequence(shortcut));
Execution Count:167
167
500 } -
501 }
executed: }
Execution Count:24150
24150
502 return list;
executed: return list;
Execution Count:161
161
503} -
504 -
505 -
506 -
507 -
508QKeySequence::~QKeySequence() -
509{ -
510 if (!d->ref.deref())
evaluated: !d->ref.deref()
TRUEFALSE
yes
Evaluation Count:4388
yes
Evaluation Count:26207
4388-26207
511 delete d;
executed: delete d;
Execution Count:4388
4388
512}
executed: }
Execution Count:30595
30595
513void QKeySequence::setKey(int key, int index) -
514{ -
515 qt_noop(); -
516 qAtomicDetach(d); -
517 d->key[index] = key; -
518}
executed: }
Execution Count:1180
1180
519 -
520 -
521 -
522 -
523 -
524int QKeySequence::count() const -
525{ -
526 if (!d->key[0])
evaluated: !d->key[0]
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1169
3-1169
527 return 0;
executed: return 0;
Execution Count:3
3
528 if (!d->key[1])
evaluated: !d->key[1]
TRUEFALSE
yes
Evaluation Count:1126
yes
Evaluation Count:43
43-1126
529 return 1;
executed: return 1;
Execution Count:1126
1126
530 if (!d->key[2])
evaluated: !d->key[2]
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:3
3-40
531 return 2;
executed: return 2;
Execution Count:40
40
532 if (!d->key[3])
partially evaluated: !d->key[3]
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
533 return 3;
executed: return 3;
Execution Count:3
3
534 return 4;
never executed: return 4;
0
535} -
536 -
537 -
538 -
539 -
540 -
541 -
542bool QKeySequence::isEmpty() const -
543{ -
544 return !d->key[0];
executed: return !d->key[0];
Execution Count:12053
12053
545} -
546QKeySequence QKeySequence::mnemonic(const QString &text) -
547{ -
548 QKeySequence ret; -
549 -
550 if(qt_sequence_no_mnemonics)
partially evaluated: qt_sequence_no_mnemonics
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3565
0-3565
551 return ret;
never executed: return ret;
0
552 -
553 bool found = false; -
554 int p = 0; -
555 while (p >= 0) {
partially evaluated: p >= 0
TRUEFALSE
yes
Evaluation Count:3578
no
Evaluation Count:0
0-3578
556 p = text.indexOf(QLatin1Char('&'), p) + 1; -
557 if (p <= 0 || p >= (int)text.length())
evaluated: p <= 0
TRUEFALSE
yes
Evaluation Count:1967
yes
Evaluation Count:1611
evaluated: p >= (int)text.length()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1609
2-1967
558 break;
executed: break;
Execution Count:1969
1969
559 if (text.at(p) != QLatin1Char('&')) {
evaluated: text.at(p) != QLatin1Char('&')
TRUEFALSE
yes
Evaluation Count:1596
yes
Evaluation Count:13
13-1596
560 QChar c = text.at(p); -
561 if (c.isPrint()) {
partially evaluated: c.isPrint()
TRUEFALSE
yes
Evaluation Count:1596
no
Evaluation Count:0
0-1596
562 if (!found) {
partially evaluated: !found
TRUEFALSE
yes
Evaluation Count:1596
no
Evaluation Count:0
0-1596
563 c = c.toUpper(); -
564 ret = QKeySequence(c.unicode() + Qt::ALT); -
565 -
566 return ret;
executed: return ret;
Execution Count:1596
1596
567 -
568 -
569 -
570 -
571 -
572 } -
573 }
never executed: }
0
574 }
never executed: }
0
575 p++; -
576 }
executed: }
Execution Count:13
13
577 return ret;
executed: return ret;
Execution Count:1969
1969
578} -
579int QKeySequence::assign(const QString &ks) -
580{ -
581 return assign(ks, NativeText);
never executed: return assign(ks, NativeText);
0
582} -
583int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format) -
584{ -
585 QString keyseq = ks; -
586 QString part; -
587 int n = 0; -
588 int p = 0, diff = 0; -
589 -
590 -
591 -
592 while (keyseq.length() && n < 4) {
evaluated: keyseq.length()
TRUEFALSE
yes
Evaluation Count:689
yes
Evaluation Count:664
partially evaluated: n < 4
TRUEFALSE
yes
Evaluation Count:689
no
Evaluation Count:0
0-689
593 -
594 -
595 -
596 p = keyseq.indexOf(QLatin1Char(',')); -
597 if (-1 != p) {
evaluated: -1 != p
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:647
42-647
598 if (p == keyseq.count() - 1) {
evaluated: p == keyseq.count() - 1
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:31
11-31
599 p = -1; -
600 } else {
executed: }
Execution Count:11
11
601 if (QLatin1Char(',') == keyseq.at(p+1))
evaluated: QLatin1Char(',') == keyseq.at(p+1)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:18
13-18
602 p++;
executed: p++;
Execution Count:13
13
603 if (QLatin1Char(' ') == keyseq.at(p+1)) {
evaluated: QLatin1Char(' ') == keyseq.at(p+1)
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:4
4-27
604 diff = 1; -
605 p++; -
606 } else {
executed: }
Execution Count:27
27
607 diff = 0; -
608 }
executed: }
Execution Count:4
4
609 } -
610 } -
611 part = keyseq.left(-1 == p ? keyseq.length() : p - diff); -
612 keyseq = keyseq.right(-1 == p ? 0 : keyseq.length() - (p + 1)); -
613 d->key[n] = QKeySequencePrivate::decodeString(part, format); -
614 ++n; -
615 }
executed: }
Execution Count:689
689
616 return n;
executed: return n;
Execution Count:664
664
617} -
618 -
619struct QModifKeyName { -
620 QModifKeyName() { } -
621 QModifKeyName(int q, QChar n) : qt_key(q), name(n) { }
never executed: }
0
622 QModifKeyName(int q, const QString &n) : qt_key(q), name(n) { }
executed: }
Execution Count:2680
2680
623 int qt_key; -
624 QString name; -
625}; -
626 -
627static QList<QModifKeyName> *globalModifs() { static QGlobalStatic<QList<QModifKeyName> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QList<QModifKeyName> *x = new QList<QModifKeyName>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QList<QModifKeyName> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:645
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:657
0-657
628static QList<QModifKeyName> *globalPortableModifs() { static QGlobalStatic<QList<QModifKeyName> > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QList<QModifKeyName> *x = new QList<QModifKeyName>; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QList<QModifKeyName> > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:31
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:32
0-32
629 -
630 -
631 -
632 -
633int QKeySequence::decodeString(const QString &str) -
634{ -
635 return QKeySequencePrivate::decodeString(str, NativeText);
never executed: return QKeySequencePrivate::decodeString(str, NativeText);
0
636} -
637 -
638int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::SequenceFormat format) -
639{ -
640 int ret = 0; -
641 QString accel = str.toLower(); -
642 bool nativeText = (format == QKeySequence::NativeText); -
643 -
644 QList<QModifKeyName> *gmodifs; -
645 if (nativeText) {
evaluated: nativeText
TRUEFALSE
yes
Evaluation Count:657
yes
Evaluation Count:32
32-657
646 gmodifs = globalModifs(); -
647 if (gmodifs->isEmpty()) {
evaluated: gmodifs->isEmpty()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:645
12-645
648 *gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+")) -
649 << QModifKeyName(Qt::SHIFT, QLatin1String("shift+")) -
650 << QModifKeyName(Qt::ALT, QLatin1String("alt+")) -
651 << QModifKeyName(Qt::META, QLatin1String("meta+")); -
652 }
executed: }
Execution Count:12
12
653 } else {
executed: }
Execution Count:657
657
654 gmodifs = globalPortableModifs(); -
655 if (gmodifs->isEmpty()) {
evaluated: gmodifs->isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:31
1-31
656 *gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+")) -
657 << QModifKeyName(Qt::SHIFT, QLatin1String("shift+")) -
658 << QModifKeyName(Qt::ALT, QLatin1String("alt+")) -
659 << QModifKeyName(Qt::META, QLatin1String("meta+")); -
660 }
executed: }
Execution Count:1
1
661 }
executed: }
Execution Count:32
32
662 if (!gmodifs) return ret;
partially evaluated: !gmodifs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:689
never executed: return ret;
0-689
663 -
664 -
665 QList<QModifKeyName> modifs; -
666 if (nativeText) {
evaluated: nativeText
TRUEFALSE
yes
Evaluation Count:657
yes
Evaluation Count:32
32-657
667 modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+'))) -
668 << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+'))) -
669 << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+'))) -
670 << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+'))); -
671 }
executed: }
Execution Count:657
657
672 modifs += *gmodifs; -
673 -
674 QString sl = accel; -
675 int i = 0; -
676 int lastI = 0; -
677 while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
evaluated: (i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1
TRUEFALSE
yes
Evaluation Count:269
yes
Evaluation Count:673
269-673
678 const QString sub = sl.mid(lastI, i - lastI + 1); -
679 if (sub.length() == 1) {
evaluated: sub.length() == 1
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:243
26-243
680 -
681 if (accel.lastIndexOf(QLatin1Char('+')) != accel.length()-1)
evaluated: accel.lastIndexOf(QLatin1Char('+')) != accel.length()-1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:22
4-22
682 return Qt::Key_unknown;
executed: return Qt::Key_unknown;
Execution Count:4
4
683 } else {
executed: }
Execution Count:22
22
684 -
685 bool validModifier = false; -
686 for (int j = 0; j < modifs.size(); ++j) {
evaluated: j < modifs.size()
TRUEFALSE
yes
Evaluation Count:569
yes
Evaluation Count:12
12-569
687 const QModifKeyName &mkf = modifs.at(j); -
688 if (sub == mkf.name) {
evaluated: sub == mkf.name
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:338
231-338
689 ret |= mkf.qt_key; -
690 validModifier = true; -
691 break;
executed: break;
Execution Count:231
231
692 } -
693 }
executed: }
Execution Count:338
338
694 -
695 if (!validModifier)
evaluated: !validModifier
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:231
12-231
696 return Qt::Key_unknown;
executed: return Qt::Key_unknown;
Execution Count:12
12
697 }
executed: }
Execution Count:231
231
698 lastI = i + 1; -
699 }
executed: }
Execution Count:253
253
700 -
701 -
702 int p = accel.lastIndexOf(QLatin1Char('+'), str.length() - 2); -
703 if(p > 0)
evaluated: p > 0
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:458
215-458
704 accel = accel.mid(p + 1);
executed: accel = accel.mid(p + 1);
Execution Count:215
215
705 -
706 int fnum = 0; -
707 if (accel.length() == 1) {
evaluated: accel.length() == 1
TRUEFALSE
yes
Evaluation Count:206
yes
Evaluation Count:467
206-467
708 -
709 -
710 -
711 -
712 -
713 -
714 { -
715 ret |= accel[0].toUpper().unicode(); -
716 } -
717 } else if (accel[0] == QLatin1Char('f') && (fnum = accel.mid(1).toInt()) && (fnum >= 1) && (fnum <= 35)) {
evaluated: accel[0] == QLatin1Char('f')
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:454
partially evaluated: (fnum = accel.mid(1).toInt())
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
partially evaluated: (fnum >= 1)
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
partially evaluated: (fnum <= 35)
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
executed: }
Execution Count:206
0-454
718 ret |= Qt::Key_F1 + fnum - 1; -
719 } else {
executed: }
Execution Count:13
13
720 -
721 -
722 -
723 bool found = false; -
724 for (int tran = 0; tran < 2; ++tran) {
evaluated: tran < 2
TRUEFALSE
yes
Evaluation Count:465
yes
Evaluation Count:11
11-465
725 if (!nativeText)
evaluated: !nativeText
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:459
6-459
726 ++tran;
executed: ++tran;
Execution Count:6
6
727 for (int i = 0; keyname[i].name; ++i) {
evaluated: keyname[i].name
TRUEFALSE
yes
Evaluation Count:74317
yes
Evaluation Count:22
22-74317
728 QString keyName(tran == 0 -
729 ? QCoreApplication::translate("QShortcut", keyname[i].name) -
730 : QString::fromLatin1(keyname[i].name)); -
731 if (accel == keyName.toLower()) {
evaluated: accel == keyName.toLower()
TRUEFALSE
yes
Evaluation Count:443
yes
Evaluation Count:73874
443-73874
732 ret |= keyname[i].key; -
733 found = true; -
734 break;
executed: break;
Execution Count:443
443
735 } -
736 }
executed: }
Execution Count:73874
73874
737 if (found)
evaluated: found
TRUEFALSE
yes
Evaluation Count:443
yes
Evaluation Count:22
22-443
738 break;
executed: break;
Execution Count:443
443
739 }
executed: }
Execution Count:22
22
740 -
741 if (!found)
evaluated: !found
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:443
11-443
742 return Qt::Key_unknown;
executed: return Qt::Key_unknown;
Execution Count:11
11
743 }
executed: }
Execution Count:443
443
744 return ret;
executed: return ret;
Execution Count:662
662
745} -
746 -
747unsigned QKeySequencePrivate::currentKeyPlatforms() -
748{ -
749 int keyboardScheme = QPlatformTheme::WindowsKeyboardScheme; -
750 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()
TRUEFALSE
yes
Evaluation Count:130133
no
Evaluation Count:0
0-130133
751 keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
executed: keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
Execution Count:130133
130133
752 unsigned result = 1u << keyboardScheme; -
753 if (keyboardScheme == QPlatformTheme::KdeKeyboardScheme
partially evaluated: keyboardScheme == QPlatformTheme::KdeKeyboardScheme
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:130133
0-130133
754 || keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
partially evaluated: keyboardScheme == QPlatformTheme::GnomeKeyboardScheme
TRUEFALSE
yes
Evaluation Count:130133
no
Evaluation Count:0
0-130133
755 || keyboardScheme == QPlatformTheme::CdeKeyboardScheme)
never evaluated: keyboardScheme == QPlatformTheme::CdeKeyboardScheme
0
756 result |= KB_X11;
executed: result |= KB_X11;
Execution Count:130133
130133
757 return result;
executed: return result;
Execution Count:130133
130133
758} -
759 -
760 -
761 -
762 -
763 -
764 -
765QString QKeySequence::encodeString(int key) -
766{ -
767 return QKeySequencePrivate::encodeString(key, NativeText);
never executed: return QKeySequencePrivate::encodeString(key, NativeText);
0
768} -
769 -
770static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format) -
771{ -
772 if (!str.isEmpty())
evaluated: !str.isEmpty()
TRUEFALSE
yes
Evaluation Count:317
yes
Evaluation Count:357
317-357
773 str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+")
evaluated: (format == QKeySequence::NativeText)
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:60
60-317
774 : QString::fromLatin1("+");
executed: str += (format == QKeySequence::NativeText) ? QCoreApplication::translate("QShortcut", "+") : QString::fromLatin1("+");
Execution Count:317
317
775 str += theKey; -
776}
executed: }
Execution Count:674
674
777 -
778QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat format) -
779{ -
780 bool nativeText = (format == QKeySequence::NativeText); -
781 QString s; -
782 -
783 -
784 if (key == -1 || key == Qt::Key_unknown)
evaluated: key == -1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:398
evaluated: key == Qt::Key_unknown
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:369
1-398
785 return s;
executed: return s;
Execution Count:30
30
786 { -
787 -
788 if ((key & Qt::META) == Qt::META)
evaluated: (key & Qt::META) == Qt::META
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:357
12-357
789 s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta");
evaluated: nativeText
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
executed: s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta");
Execution Count:12
6-12
790 if ((key & Qt::CTRL) == Qt::CTRL)
evaluated: (key & Qt::CTRL) == Qt::CTRL
TRUEFALSE
yes
Evaluation Count:246
yes
Evaluation Count:123
123-246
791 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format);
executed: addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format);
Execution Count:246
246
792 if ((key & Qt::ALT) == Qt::ALT)
evaluated: (key & Qt::ALT) == Qt::ALT
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:331
38-331
793 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
executed: addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
Execution Count:38
38
794 if ((key & Qt::SHIFT) == Qt::SHIFT)
evaluated: (key & Qt::SHIFT) == Qt::SHIFT
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:348
21-348
795 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
executed: addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
Execution Count:21
21
796 } -
797 -
798 -
799 key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier); -
800 QString p; -
801 -
802 if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
evaluated: key
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:11
evaluated: key < Qt::Key_Escape
TRUEFALSE
yes
Evaluation Count:284
yes
Evaluation Count:74
partially evaluated: key != Qt::Key_Space
TRUEFALSE
yes
Evaluation Count:284
no
Evaluation Count:0
0-358
803 if (!QChar::requiresSurrogates(key)) {
partially evaluated: !QChar::requiresSurrogates(key)
TRUEFALSE
yes
Evaluation Count:284
no
Evaluation Count:0
0-284
804 p = QChar(ushort(key)).toUpper(); -
805 } else {
executed: }
Execution Count:284
284
806 p += QChar(QChar::highSurrogate(key)); -
807 p += QChar(QChar::lowSurrogate(key)); -
808 }
never executed: }
0
809 } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
evaluated: key >= Qt::Key_F1
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:47
evaluated: key <= Qt::Key_F35
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:30
8-47
810 p = nativeText ? QCoreApplication::translate("QShortcut", "F%1").arg(key - Qt::Key_F1 + 1)
evaluated: nativeText
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
811 : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1); -
812 } else if (key) {
evaluated: key
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:11
executed: }
Execution Count:8
8-66
813 int i=0; -
814 { -
815 -
816 -
817 -
818 while (keyname[i].name) {
partially evaluated: keyname[i].name
TRUEFALSE
yes
Evaluation Count:6342
no
Evaluation Count:0
0-6342
819 if (key == keyname[i].key) {
evaluated: key == keyname[i].key
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:6276
66-6276
820 p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name)
evaluated: nativeText
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:47
19-47
821 : QString::fromLatin1(keyname[i].name); -
822 break;
executed: break;
Execution Count:66
66
823 } -
824 ++i; -
825 }
executed: }
Execution Count:6276
6276
826 -
827 -
828 -
829 -
830 if (!keyname[i].name) {
partially evaluated: !keyname[i].name
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66
0-66
831 if (!QChar::requiresSurrogates(key)) {
never evaluated: !QChar::requiresSurrogates(key)
0
832 p = QChar(ushort(key)).toUpper(); -
833 } else {
never executed: }
0
834 p += QChar(QChar::highSurrogate(key)); -
835 p += QChar(QChar::lowSurrogate(key)); -
836 }
never executed: }
0
837 } -
838 } -
839 }
executed: }
Execution Count:66
66
840 -
841 -
842 -
843 -
844 -
845 -
846 addKey(s, p, format); -
847 return s;
executed: return s;
Execution Count:369
369
848} -
849 -
850 -
851 -
852 -
853 -
854 -
855QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const -
856{ -
857 uint userN = count(), -
858 seqN = seq.count(); -
859 -
860 if (userN > seqN)
never evaluated: userN > seqN
0
861 return NoMatch;
never executed: return NoMatch;
0
862 -
863 -
864 -
865 SequenceMatch match = (userN == seqN ? ExactMatch : PartialMatch);
never evaluated: userN == seqN
0
866 -
867 for (uint i = 0; i < userN; ++i) {
never evaluated: i < userN
0
868 int userKey = (*this)[i], -
869 sequenceKey = seq[i]; -
870 if (userKey != sequenceKey)
never evaluated: userKey != sequenceKey
0
871 return NoMatch;
never executed: return NoMatch;
0
872 }
never executed: }
0
873 return match;
never executed: return match;
0
874} -
875QKeySequence::operator QVariant() const -
876{ -
877 return QVariant(QVariant::KeySequence, this);
executed: return QVariant(QVariant::KeySequence, this);
Execution Count:1
1
878} -
879int QKeySequence::operator[](uint index) const -
880{ -
881 qt_noop(); -
882 return d->key[index];
executed: return d->key[index];
Execution Count:833
833
883} -
884 -
885 -
886 -
887 -
888 -
889 -
890QKeySequence &QKeySequence::operator=(const QKeySequence &other) -
891{ -
892 qAtomicAssign(d, other.d); -
893 return *this;
executed: return *this;
Execution Count:3908
3908
894} -
895bool QKeySequence::operator==(const QKeySequence &other) const -
896{ -
897 return (d->key[0] == other.d->key[0] && 2147
898 d->key[1] == other.d->key[1] && 2147
899 d->key[2] == other.d->key[2] && 2147
900 d->key[3] == other.d->key[3]);
executed: return (d->key[0] == other.d->key[0] && d->key[1] == other.d->key[1] && d->key[2] == other.d->key[2] && d->key[3] == other.d->key[3]);
Execution Count:2147
2147
901} -
902bool QKeySequence::operator< (const QKeySequence &other) const -
903{ -
904 for (int i = 0; i < 4; ++i)
evaluated: i < 4
TRUEFALSE
yes
Evaluation Count:7574
yes
Evaluation Count:678
678-7574
905 if (d->key[i] != other.d->key[i])
evaluated: d->key[i] != other.d->key[i]
TRUEFALSE
yes
Evaluation Count:4852
yes
Evaluation Count:2722
2722-4852
906 return d->key[i] < other.d->key[i];
executed: return d->key[i] < other.d->key[i];
Execution Count:4852
4852
907 return false;
executed: return false;
Execution Count:678
678
908} -
909bool QKeySequence::isDetached() const -
910{ -
911 return d->ref.load() == 1;
never executed: return d->ref.load() == 1;
0
912} -
913QString QKeySequence::toString(SequenceFormat format) const -
914{ -
915 QString finalString; -
916 -
917 -
918 int end = count(); -
919 for (int i = 0; i < end; ++i) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:385
385-399
920 finalString += d->encodeString(d->key[i], format); -
921 finalString += QLatin1String(", "); -
922 }
executed: }
Execution Count:399
399
923 finalString.truncate(finalString.length() - 2); -
924 return finalString;
executed: return finalString;
Execution Count:385
385
925} -
926QKeySequence QKeySequence::fromString(const QString &str, SequenceFormat format) -
927{ -
928 return QKeySequence(str, format);
executed: return QKeySequence(str, format);
Execution Count:35
35
929} -
930QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) -
931{ -
932 QList<quint32> list; -
933 list << keysequence.d->key[0]; -
934 -
935 if (s.version() >= 5 && keysequence.count() > 1) {
evaluated: s.version() >= 5
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:8
evaluated: keysequence.count() > 1
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:19
8-28
936 list << keysequence.d->key[1]; -
937 list << keysequence.d->key[2]; -
938 list << keysequence.d->key[3]; -
939 }
executed: }
Execution Count:9
9
940 s << list; -
941 return s;
executed: return s;
Execution Count:36
36
942} -
943QDataStream &operator>>(QDataStream &s, QKeySequence &keysequence) -
944{ -
945 qAtomicDetach(keysequence.d); -
946 QList<quint32> list; -
947 s >> list; -
948 for (int i = 0; i < 4; ++i)
evaluated: i < 4
TRUEFALSE
yes
Evaluation Count:144
yes
Evaluation Count:36
36-144
949 keysequence.d->key[i] = list.value(i);
executed: keysequence.d->key[i] = list.value(i);
Execution Count:144
144
950 return s;
executed: return s;
Execution Count:36
36
951} -
952 -
953 -
954 -
955 -
956QDebug operator<<(QDebug dbg, const QKeySequence &p) -
957{ -
958 dbg.nospace() << "QKeySequence(" << p.toString() << ')'; -
959 return dbg.space();
executed: return dbg.space();
Execution Count:1
1
960} -
961 -
962 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial