Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qkeysequence.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qkeysequence.h"
5#include "qkeysequence_p.h"
6#include <qpa/qplatformtheme.h>
7#include "private/qguiapplication_p.h"
8
9#include "qdebug.h"
10#include <QtCore/qhashfunctions.h>
11#ifndef QT_NO_DATASTREAM
12# include "qdatastream.h"
13#endif
14#include "qvariant.h"
15
16#if defined(Q_OS_APPLE)
17#include <QtCore/private/qcore_mac_p.h>
18#endif
19
20#include <algorithm>
21#include <q20algorithm.h>
22
24
25using namespace Qt::StringLiterals;
26
27#if defined(Q_OS_APPLE) || defined(Q_QDOC)
28Q_CONSTINIT static bool qt_sequence_no_mnemonics = true;
29struct AppleSpecialKey {
30 int key;
31 ushort appleSymbol;
32};
33
34// Unicode code points for the glyphs associated with these keys
35// Defined by Carbon headers but not anywhere in Cocoa
36static constexpr int kShiftUnicode = 0x21E7;
37static constexpr int kControlUnicode = 0x2303;
38static constexpr int kOptionUnicode = 0x2325;
39static constexpr int kCommandUnicode = 0x2318;
40
41static constexpr AppleSpecialKey entries[] = {
42 { Qt::Key_Escape, 0x238B },
43 { Qt::Key_Tab, 0x21E5 },
44 { Qt::Key_Backtab, 0x21E4 },
45 { Qt::Key_Backspace, 0x232B },
46 { Qt::Key_Return, 0x21B5 },
47 { Qt::Key_Enter, 0x2324 },
48 { Qt::Key_Delete, 0x2326 },
49 { Qt::Key_Clear, 0x2327 },
50 { Qt::Key_Home, 0x2196 },
51 { Qt::Key_End, 0x2198 },
52 { Qt::Key_Left, 0x2190 },
53 { Qt::Key_Up, 0x2191 },
54 { Qt::Key_Right, 0x2192 },
55 { Qt::Key_Down, 0x2193 },
56 { Qt::Key_PageUp, 0x21DE },
57 { Qt::Key_PageDown, 0x21DF },
58 { Qt::Key_Shift, kShiftUnicode },
59 { Qt::Key_Control, kCommandUnicode },
60 { Qt::Key_Meta, kControlUnicode },
61 { Qt::Key_Alt, kOptionUnicode },
62 { Qt::Key_CapsLock, 0x21EA },
63 { Qt::Key_Eject, 0x23CF },
64};
65
66static constexpr bool operator<(const AppleSpecialKey &lhs, const AppleSpecialKey &rhs)
67{
68 return lhs.key < rhs.key;
69}
70
71static constexpr bool operator<(const AppleSpecialKey &lhs, int rhs)
72{
73 return lhs.key < rhs;
74}
75
76static constexpr bool operator<(int lhs, const AppleSpecialKey &rhs)
77{
78 return lhs < rhs.key;
79}
80
81static_assert(q20::is_sorted(std::begin(entries), std::end(entries)));
82
83static QChar appleSymbolForQtKey(int key)
84{
85 const auto i = std::lower_bound(std::begin(entries), std::end(entries), key);
86 if (i == std::end(entries) || key < *i)
87 return QChar();
88 ushort appleSymbol = i->appleSymbol;
89 if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
90 && (appleSymbol == kControlUnicode || appleSymbol == kCommandUnicode)) {
91 if (appleSymbol == kControlUnicode)
92 appleSymbol = kCommandUnicode;
93 else
94 appleSymbol = kControlUnicode;
95 }
96
97 return QChar(appleSymbol);
98}
99
100static int qtkeyForAppleSymbol(const QChar ch)
101{
102 const ushort unicode = ch.unicode();
103 for (const AppleSpecialKey &entry : entries) {
104 if (entry.appleSymbol == unicode) {
105 int key = entry.key;
106 if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
107 && (unicode == kControlUnicode || unicode == kCommandUnicode)) {
108 if (unicode == kControlUnicode)
110 else
112 }
113 return key;
114 }
115 }
116 return -1;
117}
118
119#else
120Q_CONSTINIT static bool qt_sequence_no_mnemonics = false;
121#endif
122
140
386static constexpr struct {
387 int key;
388 const char name[25];
389} keyname[] = {
390 //: This and all following "incomprehensible" strings in QShortcut context
391 //: are key names. Please use the localized names appearing on actual
392 //: keyboards or whatever is commonly used.
393 { Qt::Key_Space, QT_TRANSLATE_NOOP("QShortcut", "Space") },
394 { Qt::Key_Escape, QT_TRANSLATE_NOOP("QShortcut", "Esc") },
395 { Qt::Key_Tab, QT_TRANSLATE_NOOP("QShortcut", "Tab") },
396 { Qt::Key_Backtab, QT_TRANSLATE_NOOP("QShortcut", "Backtab") },
397 { Qt::Key_Backspace, QT_TRANSLATE_NOOP("QShortcut", "Backspace") },
398 { Qt::Key_Return, QT_TRANSLATE_NOOP("QShortcut", "Return") },
399 { Qt::Key_Enter, QT_TRANSLATE_NOOP("QShortcut", "Enter") },
400 { Qt::Key_Insert, QT_TRANSLATE_NOOP("QShortcut", "Ins") },
401 { Qt::Key_Delete, QT_TRANSLATE_NOOP("QShortcut", "Del") },
402 { Qt::Key_Pause, QT_TRANSLATE_NOOP("QShortcut", "Pause") },
403 { Qt::Key_Print, QT_TRANSLATE_NOOP("QShortcut", "Print") },
404 { Qt::Key_SysReq, QT_TRANSLATE_NOOP("QShortcut", "SysReq") },
405 { Qt::Key_Home, QT_TRANSLATE_NOOP("QShortcut", "Home") },
406 { Qt::Key_End, QT_TRANSLATE_NOOP("QShortcut", "End") },
407 { Qt::Key_Left, QT_TRANSLATE_NOOP("QShortcut", "Left") },
408 { Qt::Key_Up, QT_TRANSLATE_NOOP("QShortcut", "Up") },
409 { Qt::Key_Right, QT_TRANSLATE_NOOP("QShortcut", "Right") },
410 { Qt::Key_Down, QT_TRANSLATE_NOOP("QShortcut", "Down") },
411 { Qt::Key_PageUp, QT_TRANSLATE_NOOP("QShortcut", "PgUp") },
412 { Qt::Key_PageDown, QT_TRANSLATE_NOOP("QShortcut", "PgDown") },
413 { Qt::Key_CapsLock, QT_TRANSLATE_NOOP("QShortcut", "CapsLock") },
414 { Qt::Key_NumLock, QT_TRANSLATE_NOOP("QShortcut", "NumLock") },
415 { Qt::Key_ScrollLock, QT_TRANSLATE_NOOP("QShortcut", "ScrollLock") },
416 { Qt::Key_Menu, QT_TRANSLATE_NOOP("QShortcut", "Menu") },
417 { Qt::Key_Help, QT_TRANSLATE_NOOP("QShortcut", "Help") },
418
419 // Special keys
420 // Includes multimedia, launcher, lan keys ( bluetooth, wireless )
421 // window navigation
422 { Qt::Key_Back, QT_TRANSLATE_NOOP("QShortcut", "Back") },
423 { Qt::Key_Forward, QT_TRANSLATE_NOOP("QShortcut", "Forward") },
424 { Qt::Key_Stop, QT_TRANSLATE_NOOP("QShortcut", "Stop") },
425 { Qt::Key_Refresh, QT_TRANSLATE_NOOP("QShortcut", "Refresh") },
426 { Qt::Key_VolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Volume Down") },
427 { Qt::Key_VolumeMute, QT_TRANSLATE_NOOP("QShortcut", "Volume Mute") },
428 { Qt::Key_VolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Volume Up") },
429 { Qt::Key_BassBoost, QT_TRANSLATE_NOOP("QShortcut", "Bass Boost") },
430 { Qt::Key_BassUp, QT_TRANSLATE_NOOP("QShortcut", "Bass Up") },
431 { Qt::Key_BassDown, QT_TRANSLATE_NOOP("QShortcut", "Bass Down") },
432 { Qt::Key_TrebleUp, QT_TRANSLATE_NOOP("QShortcut", "Treble Up") },
433 { Qt::Key_TrebleDown, QT_TRANSLATE_NOOP("QShortcut", "Treble Down") },
434 { Qt::Key_MediaPlay, QT_TRANSLATE_NOOP("QShortcut", "Media Play") },
435 { Qt::Key_MediaStop, QT_TRANSLATE_NOOP("QShortcut", "Media Stop") },
436 { Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") },
437 { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") },
438 { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") },
439 //: Media player pause button
440 { Qt::Key_MediaPause, QT_TRANSLATE_NOOP("QShortcut", "Media Pause") },
441 //: Media player button to toggle between playing and paused
442 { Qt::Key_MediaTogglePlayPause, QT_TRANSLATE_NOOP("QShortcut", "Toggle Media Play/Pause") },
443 { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") },
444 { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") },
445 { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") },
446 { Qt::Key_Standby, QT_TRANSLATE_NOOP("QShortcut", "Standby") },
447 { Qt::Key_OpenUrl, QT_TRANSLATE_NOOP("QShortcut", "Open URL") },
448 { Qt::Key_LaunchMail, QT_TRANSLATE_NOOP("QShortcut", "Launch Mail") },
449 { Qt::Key_LaunchMedia, QT_TRANSLATE_NOOP("QShortcut", "Launch Media") },
450 { Qt::Key_Launch0, QT_TRANSLATE_NOOP("QShortcut", "Launch (0)") },
451 { Qt::Key_Launch1, QT_TRANSLATE_NOOP("QShortcut", "Launch (1)") },
452 { Qt::Key_Launch2, QT_TRANSLATE_NOOP("QShortcut", "Launch (2)") },
453 { Qt::Key_Launch3, QT_TRANSLATE_NOOP("QShortcut", "Launch (3)") },
454 { Qt::Key_Launch4, QT_TRANSLATE_NOOP("QShortcut", "Launch (4)") },
455 { Qt::Key_Launch5, QT_TRANSLATE_NOOP("QShortcut", "Launch (5)") },
456 { Qt::Key_Launch6, QT_TRANSLATE_NOOP("QShortcut", "Launch (6)") },
457 { Qt::Key_Launch7, QT_TRANSLATE_NOOP("QShortcut", "Launch (7)") },
458 { Qt::Key_Launch8, QT_TRANSLATE_NOOP("QShortcut", "Launch (8)") },
459 { Qt::Key_Launch9, QT_TRANSLATE_NOOP("QShortcut", "Launch (9)") },
460 { Qt::Key_LaunchA, QT_TRANSLATE_NOOP("QShortcut", "Launch (A)") },
461 { Qt::Key_LaunchB, QT_TRANSLATE_NOOP("QShortcut", "Launch (B)") },
462 { Qt::Key_LaunchC, QT_TRANSLATE_NOOP("QShortcut", "Launch (C)") },
463 { Qt::Key_LaunchD, QT_TRANSLATE_NOOP("QShortcut", "Launch (D)") },
464 { Qt::Key_LaunchE, QT_TRANSLATE_NOOP("QShortcut", "Launch (E)") },
465 { Qt::Key_LaunchF, QT_TRANSLATE_NOOP("QShortcut", "Launch (F)") },
466 { Qt::Key_LaunchG, QT_TRANSLATE_NOOP("QShortcut", "Launch (G)") },
467 { Qt::Key_LaunchH, QT_TRANSLATE_NOOP("QShortcut", "Launch (H)") },
468 { Qt::Key_MonBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Up") },
469 { Qt::Key_MonBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Monitor Brightness Down") },
470 { Qt::Key_KeyboardLightOnOff, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Light On/Off") },
471 { Qt::Key_KeyboardBrightnessUp, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Up") },
472 { Qt::Key_KeyboardBrightnessDown, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Brightness Down") },
473 { Qt::Key_PowerOff, QT_TRANSLATE_NOOP("QShortcut", "Power Off") },
474 { Qt::Key_WakeUp, QT_TRANSLATE_NOOP("QShortcut", "Wake Up") },
475 { Qt::Key_Eject, QT_TRANSLATE_NOOP("QShortcut", "Eject") },
476 { Qt::Key_ScreenSaver, QT_TRANSLATE_NOOP("QShortcut", "Screensaver") },
477 { Qt::Key_WWW, QT_TRANSLATE_NOOP("QShortcut", "WWW") },
478 { Qt::Key_Sleep, QT_TRANSLATE_NOOP("QShortcut", "Sleep") },
479 { Qt::Key_LightBulb, QT_TRANSLATE_NOOP("QShortcut", "LightBulb") },
480 { Qt::Key_Shop, QT_TRANSLATE_NOOP("QShortcut", "Shop") },
481 { Qt::Key_History, QT_TRANSLATE_NOOP("QShortcut", "History") },
482 { Qt::Key_AddFavorite, QT_TRANSLATE_NOOP("QShortcut", "Add Favorite") },
483 { Qt::Key_HotLinks, QT_TRANSLATE_NOOP("QShortcut", "Hot Links") },
484 { Qt::Key_BrightnessAdjust, QT_TRANSLATE_NOOP("QShortcut", "Adjust Brightness") },
485 { Qt::Key_Finance, QT_TRANSLATE_NOOP("QShortcut", "Finance") },
486 { Qt::Key_Community, QT_TRANSLATE_NOOP("QShortcut", "Community") },
487 { Qt::Key_AudioRewind, QT_TRANSLATE_NOOP("QShortcut", "Media Rewind") },
488 { Qt::Key_BackForward, QT_TRANSLATE_NOOP("QShortcut", "Back Forward") },
489 { Qt::Key_ApplicationLeft, QT_TRANSLATE_NOOP("QShortcut", "Application Left") },
490 { Qt::Key_ApplicationRight, QT_TRANSLATE_NOOP("QShortcut", "Application Right") },
491 { Qt::Key_Book, QT_TRANSLATE_NOOP("QShortcut", "Book") },
492 { Qt::Key_CD, QT_TRANSLATE_NOOP("QShortcut", "CD") },
493 { Qt::Key_Calculator, QT_TRANSLATE_NOOP("QShortcut", "Calculator") },
494 { Qt::Key_Calendar, QT_TRANSLATE_NOOP("QShortcut", "Calendar") },
495 { Qt::Key_Clear, QT_TRANSLATE_NOOP("QShortcut", "Clear") },
496 { Qt::Key_ClearGrab, QT_TRANSLATE_NOOP("QShortcut", "Clear Grab") },
497 { Qt::Key_Close, QT_TRANSLATE_NOOP("QShortcut", "Close") },
498 { Qt::Key_ContrastAdjust, QT_TRANSLATE_NOOP("QShortcut", "Adjust contrast") },
499 { Qt::Key_Copy, QT_TRANSLATE_NOOP("QShortcut", "Copy") },
500 { Qt::Key_Cut, QT_TRANSLATE_NOOP("QShortcut", "Cut") },
501 { Qt::Key_Display, QT_TRANSLATE_NOOP("QShortcut", "Display") },
502 { Qt::Key_DOS, QT_TRANSLATE_NOOP("QShortcut", "DOS") },
503 { Qt::Key_Documents, QT_TRANSLATE_NOOP("QShortcut", "Documents") },
504 { Qt::Key_Excel, QT_TRANSLATE_NOOP("QShortcut", "Spreadsheet") },
505 { Qt::Key_Explorer, QT_TRANSLATE_NOOP("QShortcut", "Browser") },
506 { Qt::Key_Game, QT_TRANSLATE_NOOP("QShortcut", "Game") },
507 { Qt::Key_Go, QT_TRANSLATE_NOOP("QShortcut", "Go") },
508 { Qt::Key_iTouch, QT_TRANSLATE_NOOP("QShortcut", "iTouch") },
509 { Qt::Key_LogOff, QT_TRANSLATE_NOOP("QShortcut", "Logoff") },
510 { Qt::Key_Market, QT_TRANSLATE_NOOP("QShortcut", "Market") },
511 { Qt::Key_Meeting, QT_TRANSLATE_NOOP("QShortcut", "Meeting") },
512 { Qt::Key_Memo, QT_TRANSLATE_NOOP("QShortcut", "Memo") },
513 { Qt::Key_MenuKB, QT_TRANSLATE_NOOP("QShortcut", "Keyboard Menu") },
514 { Qt::Key_MenuPB, QT_TRANSLATE_NOOP("QShortcut", "Menu PB") },
515 { Qt::Key_MySites, QT_TRANSLATE_NOOP("QShortcut", "My Sites") },
516 { Qt::Key_News, QT_TRANSLATE_NOOP("QShortcut", "News") },
517 { Qt::Key_OfficeHome, QT_TRANSLATE_NOOP("QShortcut", "Home Office") },
518 { Qt::Key_Option, QT_TRANSLATE_NOOP("QShortcut", "Option") },
519 { Qt::Key_Paste, QT_TRANSLATE_NOOP("QShortcut", "Paste") },
520 { Qt::Key_Phone, QT_TRANSLATE_NOOP("QShortcut", "Phone") },
521 { Qt::Key_Reply, QT_TRANSLATE_NOOP("QShortcut", "Reply") },
522 { Qt::Key_Reload, QT_TRANSLATE_NOOP("QShortcut", "Reload") },
523 { Qt::Key_RotateWindows, QT_TRANSLATE_NOOP("QShortcut", "Rotate Windows") },
524 { Qt::Key_RotationPB, QT_TRANSLATE_NOOP("QShortcut", "Rotation PB") },
525 { Qt::Key_RotationKB, QT_TRANSLATE_NOOP("QShortcut", "Rotation KB") },
526 { Qt::Key_Save, QT_TRANSLATE_NOOP("QShortcut", "Save") },
527 { Qt::Key_Send, QT_TRANSLATE_NOOP("QShortcut", "Send") },
528 { Qt::Key_Spell, QT_TRANSLATE_NOOP("QShortcut", "Spellchecker") },
529 { Qt::Key_SplitScreen, QT_TRANSLATE_NOOP("QShortcut", "Split Screen") },
530 { Qt::Key_Support, QT_TRANSLATE_NOOP("QShortcut", "Support") },
531 { Qt::Key_TaskPane, QT_TRANSLATE_NOOP("QShortcut", "Task Panel") },
532 { Qt::Key_Terminal, QT_TRANSLATE_NOOP("QShortcut", "Terminal") },
533 { Qt::Key_ToDoList, QT_TRANSLATE_NOOP("QShortcut", "To-do list") },
534 { Qt::Key_Tools, QT_TRANSLATE_NOOP("QShortcut", "Tools") },
535 { Qt::Key_Travel, QT_TRANSLATE_NOOP("QShortcut", "Travel") },
536 { Qt::Key_Video, QT_TRANSLATE_NOOP("QShortcut", "Video") },
537 { Qt::Key_Word, QT_TRANSLATE_NOOP("QShortcut", "Word Processor") },
538 { Qt::Key_Xfer, QT_TRANSLATE_NOOP("QShortcut", "XFer") },
539 { Qt::Key_ZoomIn, QT_TRANSLATE_NOOP("QShortcut", "Zoom In") },
540 { Qt::Key_ZoomOut, QT_TRANSLATE_NOOP("QShortcut", "Zoom Out") },
541 { Qt::Key_Away, QT_TRANSLATE_NOOP("QShortcut", "Away") },
542 { Qt::Key_Messenger, QT_TRANSLATE_NOOP("QShortcut", "Messenger") },
543 { Qt::Key_WebCam, QT_TRANSLATE_NOOP("QShortcut", "WebCam") },
544 { Qt::Key_MailForward, QT_TRANSLATE_NOOP("QShortcut", "Mail Forward") },
545 { Qt::Key_Pictures, QT_TRANSLATE_NOOP("QShortcut", "Pictures") },
546 { Qt::Key_Music, QT_TRANSLATE_NOOP("QShortcut", "Music") },
547 { Qt::Key_Battery, QT_TRANSLATE_NOOP("QShortcut", "Battery") },
548 { Qt::Key_Bluetooth, QT_TRANSLATE_NOOP("QShortcut", "Bluetooth") },
549 { Qt::Key_WLAN, QT_TRANSLATE_NOOP("QShortcut", "Wireless") },
550 { Qt::Key_UWB, QT_TRANSLATE_NOOP("QShortcut", "Ultra Wide Band") },
551 { Qt::Key_AudioForward, QT_TRANSLATE_NOOP("QShortcut", "Media Fast Forward") },
552 { Qt::Key_AudioRepeat, QT_TRANSLATE_NOOP("QShortcut", "Audio Repeat") },
553 { Qt::Key_AudioRandomPlay, QT_TRANSLATE_NOOP("QShortcut", "Audio Random Play") },
554 { Qt::Key_Subtitle, QT_TRANSLATE_NOOP("QShortcut", "Subtitle") },
555 { Qt::Key_AudioCycleTrack, QT_TRANSLATE_NOOP("QShortcut", "Audio Cycle Track") },
556 { Qt::Key_Time, QT_TRANSLATE_NOOP("QShortcut", "Time") },
557 { Qt::Key_Hibernate, QT_TRANSLATE_NOOP("QShortcut", "Hibernate") },
558 { Qt::Key_View, QT_TRANSLATE_NOOP("QShortcut", "View") },
559 { Qt::Key_TopMenu, QT_TRANSLATE_NOOP("QShortcut", "Top Menu") },
560 { Qt::Key_PowerDown, QT_TRANSLATE_NOOP("QShortcut", "Power Down") },
561 { Qt::Key_Suspend, QT_TRANSLATE_NOOP("QShortcut", "Suspend") },
562
563 { Qt::Key_MicMute, QT_TRANSLATE_NOOP("QShortcut", "Microphone Mute") },
564
565 { Qt::Key_Red, QT_TRANSLATE_NOOP("QShortcut", "Red") },
566 { Qt::Key_Green, QT_TRANSLATE_NOOP("QShortcut", "Green") },
567 { Qt::Key_Yellow, QT_TRANSLATE_NOOP("QShortcut", "Yellow") },
568 { Qt::Key_Blue, QT_TRANSLATE_NOOP("QShortcut", "Blue") },
569
570 { Qt::Key_ChannelUp, QT_TRANSLATE_NOOP("QShortcut", "Channel Up") },
571 { Qt::Key_ChannelDown, QT_TRANSLATE_NOOP("QShortcut", "Channel Down") },
572
573 { Qt::Key_Guide, QT_TRANSLATE_NOOP("QShortcut", "Guide") },
574 { Qt::Key_Info, QT_TRANSLATE_NOOP("QShortcut", "Info") },
575 { Qt::Key_Settings, QT_TRANSLATE_NOOP("QShortcut", "Settings") },
576
577 { Qt::Key_MicVolumeUp, QT_TRANSLATE_NOOP("QShortcut", "Microphone Volume Up") },
578 { Qt::Key_MicVolumeDown, QT_TRANSLATE_NOOP("QShortcut", "Microphone Volume Down") },
579
580 { Qt::Key_New, QT_TRANSLATE_NOOP("QShortcut", "New") },
581 { Qt::Key_Open, QT_TRANSLATE_NOOP("QShortcut", "Open") },
582 { Qt::Key_Find, QT_TRANSLATE_NOOP("QShortcut", "Find") },
583 { Qt::Key_Undo, QT_TRANSLATE_NOOP("QShortcut", "Undo") },
584 { Qt::Key_Redo, QT_TRANSLATE_NOOP("QShortcut", "Redo") },
585
586 // --------------------------------------------------------------
587 // More consistent namings
588 { Qt::Key_Print, QT_TRANSLATE_NOOP("QShortcut", "Print Screen") },
589 { Qt::Key_PageUp, QT_TRANSLATE_NOOP("QShortcut", "Page Up") },
590 { Qt::Key_PageDown, QT_TRANSLATE_NOOP("QShortcut", "Page Down") },
591 { Qt::Key_CapsLock, QT_TRANSLATE_NOOP("QShortcut", "Caps Lock") },
592 { Qt::Key_NumLock, QT_TRANSLATE_NOOP("QShortcut", "Num Lock") },
593 { Qt::Key_NumLock, QT_TRANSLATE_NOOP("QShortcut", "Number Lock") },
594 { Qt::Key_ScrollLock, QT_TRANSLATE_NOOP("QShortcut", "Scroll Lock") },
595 { Qt::Key_Insert, QT_TRANSLATE_NOOP("QShortcut", "Insert") },
596 { Qt::Key_Delete, QT_TRANSLATE_NOOP("QShortcut", "Delete") },
597 { Qt::Key_Escape, QT_TRANSLATE_NOOP("QShortcut", "Escape") },
598 { Qt::Key_SysReq, QT_TRANSLATE_NOOP("QShortcut", "System Request") },
599
600 // --------------------------------------------------------------
601 // Keypad navigation keys
602 { Qt::Key_Select, QT_TRANSLATE_NOOP("QShortcut", "Select") },
603 { Qt::Key_Yes, QT_TRANSLATE_NOOP("QShortcut", "Yes") },
604 { Qt::Key_No, QT_TRANSLATE_NOOP("QShortcut", "No") },
605
606 // --------------------------------------------------------------
607 // Device keys
608 { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") },
609 { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") },
610 { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") },
611 { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") },
612 //: Button to start a call (note: a separate button is used to end the call)
613 { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") },
614 //: Button to end a call (note: a separate button is used to start the call)
615 { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") },
616 //: Button that will hang up if we're in call, or make a call if we're not.
617 { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") },
618 { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") },
619 //: Button to trigger voice dialing
620 { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") },
621 //: Button to redial the last number called
622 { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") },
623 //: Button to trigger the camera shutter (take a picture)
624 { Qt::Key_Camera, QT_TRANSLATE_NOOP("QShortcut", "Camera Shutter") },
625 //: Button to focus the camera
626 { Qt::Key_CameraFocus, QT_TRANSLATE_NOOP("QShortcut", "Camera Focus") },
627
628 // --------------------------------------------------------------
629 // Japanese keyboard support
630 { Qt::Key_Kanji, QT_TRANSLATE_NOOP("QShortcut", "Kanji") },
631 { Qt::Key_Muhenkan, QT_TRANSLATE_NOOP("QShortcut", "Muhenkan") },
632 { Qt::Key_Henkan, QT_TRANSLATE_NOOP("QShortcut", "Henkan") },
633 { Qt::Key_Romaji, QT_TRANSLATE_NOOP("QShortcut", "Romaji") },
634 { Qt::Key_Hiragana, QT_TRANSLATE_NOOP("QShortcut", "Hiragana") },
635 { Qt::Key_Katakana, QT_TRANSLATE_NOOP("QShortcut", "Katakana") },
636 { Qt::Key_Hiragana_Katakana,QT_TRANSLATE_NOOP("QShortcut", "Hiragana Katakana") },
637 { Qt::Key_Zenkaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku") },
638 { Qt::Key_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Hankaku") },
639 { Qt::Key_Zenkaku_Hankaku, QT_TRANSLATE_NOOP("QShortcut", "Zenkaku Hankaku") },
640 { Qt::Key_Touroku, QT_TRANSLATE_NOOP("QShortcut", "Touroku") },
641 { Qt::Key_Massyo, QT_TRANSLATE_NOOP("QShortcut", "Massyo") },
642 { Qt::Key_Kana_Lock, QT_TRANSLATE_NOOP("QShortcut", "Kana Lock") },
643 { Qt::Key_Kana_Shift, QT_TRANSLATE_NOOP("QShortcut", "Kana Shift") },
644 { Qt::Key_Eisu_Shift, QT_TRANSLATE_NOOP("QShortcut", "Eisu Shift") },
645 { Qt::Key_Eisu_toggle, QT_TRANSLATE_NOOP("QShortcut", "Eisu toggle") },
646 { Qt::Key_Codeinput, QT_TRANSLATE_NOOP("QShortcut", "Code input") },
647 { Qt::Key_MultipleCandidate,QT_TRANSLATE_NOOP("QShortcut", "Multiple Candidate") },
648 { Qt::Key_PreviousCandidate,QT_TRANSLATE_NOOP("QShortcut", "Previous Candidate") },
649
650 // --------------------------------------------------------------
651 // Korean keyboard support
652 { Qt::Key_Hangul, QT_TRANSLATE_NOOP("QShortcut", "Hangul") },
653 { Qt::Key_Hangul_Start, QT_TRANSLATE_NOOP("QShortcut", "Hangul Start") },
654 { Qt::Key_Hangul_End, QT_TRANSLATE_NOOP("QShortcut", "Hangul End") },
655 { Qt::Key_Hangul_Hanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Hanja") },
656 { Qt::Key_Hangul_Jamo, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jamo") },
657 { Qt::Key_Hangul_Romaja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Romaja") },
658 { Qt::Key_Hangul_Jeonja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Jeonja") },
659 { Qt::Key_Hangul_Banja, QT_TRANSLATE_NOOP("QShortcut", "Hangul Banja") },
660 { Qt::Key_Hangul_PreHanja, QT_TRANSLATE_NOOP("QShortcut", "Hangul PreHanja") },
661 { Qt::Key_Hangul_PostHanja,QT_TRANSLATE_NOOP("QShortcut", "Hangul PostHanja") },
662 { Qt::Key_Hangul_Special, QT_TRANSLATE_NOOP("QShortcut", "Hangul Special") },
663
664 // --------------------------------------------------------------
665 // Miscellaneous keys
666 { Qt::Key_Cancel, QT_TRANSLATE_NOOP("QShortcut", "Cancel") },
667 { Qt::Key_Printer, QT_TRANSLATE_NOOP("QShortcut", "Printer") },
668 { Qt::Key_Execute, QT_TRANSLATE_NOOP("QShortcut", "Execute") },
669 { Qt::Key_Play, QT_TRANSLATE_NOOP("QShortcut", "Play") },
670 { Qt::Key_Zoom, QT_TRANSLATE_NOOP("QShortcut", "Zoom") },
671 { Qt::Key_Exit, QT_TRANSLATE_NOOP("QShortcut", "Exit") },
672 { Qt::Key_TouchpadToggle, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Toggle") },
673 { Qt::Key_TouchpadOn, QT_TRANSLATE_NOOP("QShortcut", "Touchpad On") },
674 { Qt::Key_TouchpadOff, QT_TRANSLATE_NOOP("QShortcut", "Touchpad Off") },
675 { Qt::Key_Shift, QT_TRANSLATE_NOOP("QShortcut", "Shift") },
676 { Qt::Key_Control, QT_TRANSLATE_NOOP("QShortcut", "Control") },
677 { Qt::Key_Alt, QT_TRANSLATE_NOOP("QShortcut", "Alt") },
678 { Qt::Key_Meta, QT_TRANSLATE_NOOP("QShortcut", "Meta") },
679
681static constexpr int numKeyNames = sizeof keyname / sizeof *keyname;
682
784{
785 const QList <QKeySequence> bindings = keyBindings(key);
786 //pick only the first/primary shortcut from current bindings
787 if (!bindings.isEmpty()) {
788 d = bindings.constFirst().d;
789 d->ref.ref();
790 }
791 else
792 d = new QKeySequencePrivate();
793}
794
795
800{
801 Q_CONSTINIT static QKeySequencePrivate shared_empty;
802 d = &shared_empty;
803 d->ref.ref();
804}
805
830
831static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs and ctor impl below");
840QKeySequence::QKeySequence(int k1, int k2, int k3, int k4)
841{
842 d = new QKeySequencePrivate();
843 d->key[0] = k1;
844 d->key[1] = k2;
845 d->key[2] = k3;
846 d->key[3] = k4;
847}
848
856 : QKeySequence(k1.toCombined(), k2.toCombined(), k3.toCombined(), k4.toCombined())
857{
858}
859
864 : d(keysequence.d)
865{
866 d->ref.ref();
867}
868
879{
880 return QGuiApplicationPrivate::platformTheme()->keyBindings(key);
881}
882
887{
888 if (!d->ref.deref())
889 delete d;
890}
891
899void QKeySequence::setKey(QKeyCombination key, int index)
900{
901 Q_ASSERT_X(index >= 0 && index < QKeySequencePrivate::MaxKeyCount, "QKeySequence::setKey", "index out of range");
902 qAtomicDetach(d);
903 d->key[index] = key.toCombined();
904}
905
906static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Change docs below");
912{
913 return int(std::distance(d->key, std::find(d->key, d->key + QKeySequencePrivate::MaxKeyCount, 0)));
914}
915
916
922{
923 return !d->key[0];
924}
925
926
936{
938
940 return ret;
941
942 bool found = false;
943 qsizetype p = 0;
944 while (p >= 0) {
945 p = text.indexOf(u'&', p) + 1;
946 if (p <= 0 || p >= (int)text.size())
947 break;
948 if (text.at(p) != u'&') {
949 QChar c = text.at(p);
950 if (c.isPrint()) {
951 if (!found) {
952 c = c.toUpper();
954#ifdef QT_NO_DEBUG
955 return ret;
956#else
957 found = true;
958 } else {
959 qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurrences of '&'", qPrintable(text));
960#endif
961 }
962 }
963 }
964 p++;
965 }
966 return ret;
967}
968
978int QKeySequence::assign(const QString &ks)
979{
980 return assign(ks, NativeText);
981}
982
992int QKeySequence::assign(const QString &ks, QKeySequence::SequenceFormat format)
993{
994 QString keyseq = ks;
995 int n = 0;
996 qsizetype p = 0, diff = 0;
997
998 // Run through the whole string, but stop
999 // if we have MaxKeyCount keys before the end.
1000 while (keyseq.size() && n < QKeySequencePrivate::MaxKeyCount) {
1001 // We MUST use something to separate each sequence, and space
1002 // does not cut it, since some of the key names have space
1003 // in them.. (Let's hope no one translate with a comma in it:)
1004 p = keyseq.indexOf(u',');
1005 if (-1 != p) {
1006 if (p == keyseq.size() - 1) { // Last comma 'Ctrl+,'
1007 p = -1;
1008 } else {
1009 if (u',' == keyseq.at(p+1)) // e.g. 'Ctrl+,, Shift+,,'
1010 p++;
1011 if (u' ' == keyseq.at(p+1)) { // Space after comma
1012 diff = 1;
1013 p++;
1014 } else {
1015 diff = 0;
1016 }
1017 }
1018 }
1019 QString part = keyseq.left(-1 == p ? keyseq.size() : p - diff);
1020 keyseq = keyseq.right(-1 == p ? 0 : keyseq.size() - (p + 1));
1021 d->key[n] = QKeySequencePrivate::decodeString(std::move(part), format).toCombined();
1022 ++n;
1023 }
1024 return n;
1025}
1026
1035
1036Q_GLOBAL_STATIC(QList<QModifKeyName>, globalModifs)
1037Q_GLOBAL_STATIC(QList<QModifKeyName>, globalPortableModifs)
1038
1040{
1041 Q_ASSERT(!accel.isEmpty());
1042
1043 int ret = 0;
1044 accel = std::move(accel).toLower();
1045 bool nativeText = (format == QKeySequence::NativeText);
1046
1047 QList<QModifKeyName> *gmodifs;
1048 if (nativeText) {
1049 gmodifs = globalModifs();
1050 if (gmodifs->isEmpty()) {
1051#if defined(Q_OS_APPLE)
1052 const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
1053 if (dontSwap)
1054 *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
1055 else
1056 *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode));
1057 *gmodifs << QModifKeyName(Qt::ALT, QChar(kOptionUnicode));
1058 if (dontSwap)
1059 *gmodifs << QModifKeyName(Qt::CTRL, QChar(kControlUnicode));
1060 else
1061 *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
1062 *gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode));
1063#endif
1064 *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
1065 << QModifKeyName(Qt::SHIFT, u"shift+"_s)
1066 << QModifKeyName(Qt::ALT, u"alt+"_s)
1067 << QModifKeyName(Qt::META, u"meta+"_s)
1068 << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
1069 }
1070 } else {
1071 gmodifs = globalPortableModifs();
1072 if (gmodifs->isEmpty()) {
1073 *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
1074 << QModifKeyName(Qt::SHIFT, u"shift+"_s)
1075 << QModifKeyName(Qt::ALT, u"alt+"_s)
1076 << QModifKeyName(Qt::META, u"meta+"_s)
1077 << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
1078 }
1079 }
1080
1081
1082 QList<QModifKeyName> modifs;
1083 if (nativeText) {
1084 modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(u'+'))
1085 << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(u'+'))
1086 << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(u'+'))
1087 << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(u'+'))
1088 << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(u'+'));
1089 }
1090 modifs += *gmodifs; // Test non-translated ones last
1091
1092 QString sl = accel;
1093#if defined(Q_OS_APPLE)
1094 for (int i = 0; i < modifs.size(); ++i) {
1095 const QModifKeyName &mkf = modifs.at(i);
1096 if (sl.contains(mkf.name)) {
1097 ret |= mkf.qt_key;
1098 accel.remove(mkf.name);
1099 sl = accel;
1100 }
1101 }
1102 if (accel.isEmpty()) // Incomplete, like for "Meta+Shift+"
1103 return Qt::Key_unknown;
1104#endif
1105
1106 qsizetype i = 0;
1107 qsizetype lastI = 0;
1108 while ((i = sl.indexOf(u'+', i + 1)) != -1) {
1109 const QStringView sub = QStringView{sl}.mid(lastI, i - lastI + 1);
1110 // If we get here the shortcuts contains at least one '+'. We break up
1111 // along the following strategy:
1112 // Meta+Ctrl++ ( "Meta+", "Ctrl+", "+" )
1113 // Super+Shift+A ( "Super+", "Shift+" )
1114 // 4+3+2=1 ( "4+", "3+" )
1115 // In other words, everything we try to handle HAS to be a modifier
1116 // except for a single '+' at the end of the string.
1117
1118 // Only '+' can have length 1.
1119 if (sub.size() == 1) {
1120 // Make sure we only encounter a single '+' at the end of the accel
1121 if (accel.lastIndexOf(u'+') != accel.size()-1)
1122 return Qt::Key_unknown;
1123 } else {
1124 // Identify the modifier
1125 bool validModifier = false;
1126 for (int j = 0; j < modifs.size(); ++j) {
1127 const QModifKeyName &mkf = modifs.at(j);
1128 if (sub == mkf.name) {
1129 ret |= mkf.qt_key;
1130 validModifier = true;
1131 break; // Shortcut, since if we find an other it would/should just be a dup
1132 }
1133 }
1134
1135 if (!validModifier)
1136 return Qt::Key_unknown;
1137 }
1138 lastI = i + 1;
1139 }
1140
1141 qsizetype p = accel.lastIndexOf(u'+', accel.size() - 2); // -2 so that Ctrl++ works
1142 QStringView accelRef(accel);
1143 if (p > 0)
1144 accelRef = accelRef.mid(p + 1);
1145
1146 int fnum = 0;
1147 if (accelRef.size() == 1) {
1148#if defined(Q_OS_APPLE)
1149 int qtKey = qtkeyForAppleSymbol(accelRef.at(0));
1150 if (qtKey != -1) {
1151 ret |= qtKey;
1152 } else
1153#endif
1154 {
1155 ret |= accelRef.at(0).toUpper().unicode();
1156 }
1157 } else if (accelRef.at(0) == u'f' && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
1158 ret |= Qt::Key_F1 + fnum - 1;
1159 } else {
1160 // For NativeText, check the translation table first,
1161 // if we don't find anything then try it out with just the untranlated stuff.
1162 // PortableText will only try the untranlated table.
1163 bool found = false;
1164 for (int tran = 0; tran < 2; ++tran) {
1165 if (!nativeText)
1166 ++tran;
1167 for (int i = 0; i < numKeyNames; ++i) {
1168 QString keyName(tran == 0
1169 ? QCoreApplication::translate("QShortcut", keyname[i].name)
1171 if (accelRef == std::move(keyName).toLower()) {
1172 ret |= keyname[i].key;
1173 found = true;
1174 break;
1175 }
1176 }
1177 if (found)
1178 break;
1179 }
1180 // We couldn't translate the key.
1181 if (!found)
1182 return Qt::Key_unknown;
1183 }
1185}
1186
1187static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
1188{
1189 if (!str.isEmpty()) {
1191 //: Key separator in shortcut string
1192 str += QCoreApplication::translate("QShortcut", "+");
1193 } else {
1194 str += u'+';
1195 }
1196 }
1197
1198 str += theKey;
1199}
1200
1202{
1203 bool nativeText = (format == QKeySequence::NativeText);
1204 QString s;
1205
1206 const auto key = keyCombination.key();
1207
1208 // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
1209 if (keyCombination.toCombined() == -1 || key == Qt::Key_unknown)
1210 return s;
1211
1212 const auto modifiers = keyCombination.keyboardModifiers();
1213
1214#if defined(Q_OS_APPLE)
1215 if (nativeText) {
1216 // On Apple platforms the order (by default) is Meta, Alt, Shift, Control.
1217 // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
1218 // is Ctrl, Alt, Shift, Meta. The appleSymbolForQtKey helper does this swap
1219 // for us, which means that we have to adjust our order here.
1220 // The upshot is a lot more infrastructure to keep the number of
1221 // if tests down and the code relatively clean.
1222 static constexpr int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 };
1223 static constexpr int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 };
1224 static constexpr int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 };
1225 static constexpr int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 };
1226 const int *modifierOrder;
1227 const int *qtkeyOrder;
1228 if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
1229 modifierOrder = DontSwapModifierOrder;
1230 qtkeyOrder = DontSwapQtKeyOrder;
1231 } else {
1232 modifierOrder = ModifierOrder;
1233 qtkeyOrder = QtKeyOrder;
1234 }
1235
1236 for (int i = 0; modifierOrder[i] != 0; ++i) {
1237 if (modifiers & modifierOrder[i])
1238 s += appleSymbolForQtKey(qtkeyOrder[i]);
1239 }
1240 } else
1241#endif
1242 {
1243 // On other systems the order is Meta, Control, Alt, Shift
1245 s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta");
1247 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format);
1249 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
1251 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
1252 }
1254 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format);
1255
1257
1258#if defined(Q_OS_APPLE)
1259 if (nativeText)
1260 s += keyName;
1261 else
1262#endif
1264 return s;
1265}
1266
1276{
1277 bool nativeText = (format == QKeySequence::NativeText);
1278 QString p;
1279
1280 if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
1281 if (!QChar::requiresSurrogates(key)) {
1282 p = QChar::fromUcs2(key).toUpper();
1283 } else {
1284 p += QChar(QChar::highSurrogate(key));
1285 p += QChar(QChar::lowSurrogate(key));
1286 }
1287 } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
1288 p = nativeText ? QCoreApplication::translate("QShortcut", "F%1").arg(key - Qt::Key_F1 + 1)
1289 : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
1290 } else if (key) {
1291 int i=0;
1292#if defined(Q_OS_APPLE)
1293 if (nativeText) {
1294 QChar ch = appleSymbolForQtKey(key);
1295 if (!ch.isNull())
1296 p = ch;
1297 else
1298 goto NonSymbol;
1299 } else
1300#endif
1301 {
1302#if defined(Q_OS_APPLE)
1303NonSymbol:
1304#endif
1305 while (i < numKeyNames) {
1306 if (key == keyname[i].key) {
1307 p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name)
1309 break;
1310 }
1311 ++i;
1312 }
1313 // If we can't find the actual translatable keyname,
1314 // fall back on the unicode representation of it...
1315 // Or else characters like Qt::Key_aring may not get displayed
1316 // (Really depends on you locale)
1317 if (i >= numKeyNames) {
1318 if (!QChar::requiresSurrogates(key)) {
1319 p = QChar::fromUcs2(key).toUpper();
1320 } else {
1321 p += QChar(QChar::highSurrogate(key));
1322 p += QChar(QChar::lowSurrogate(key));
1323 }
1324 }
1325 }
1326 }
1327 return p;
1328}
1336{
1337 uint userN = count(),
1338 seqN = seq.count();
1339
1340 if (userN > seqN)
1341 return NoMatch;
1342
1343 // If equal in length, we have a potential ExactMatch sequence,
1344 // else we already know it can only be partial.
1345 SequenceMatch match = (userN == seqN ? ExactMatch : PartialMatch);
1346
1347 for (uint i = 0; i < userN; ++i) {
1348 QKeyCombination userKey = (*this)[i],
1349 sequenceKey = seq[i];
1350 if (userKey != sequenceKey)
1351 return NoMatch;
1352 }
1353 return match;
1354}
1355
1359QKeySequence::operator QVariant() const
1360{
1361 return QVariant::fromValue(*this);
1362}
1363
1369{
1370 Q_ASSERT_X(index < QKeySequencePrivate::MaxKeyCount, "QKeySequence::operator[]", "index out of range");
1372}
1373
1374
1380{
1381 qAtomicAssign(d, other.d);
1382 return *this;
1383}
1384
1406{
1407 return (d->key[0] == other.d->key[0] &&
1408 d->key[1] == other.d->key[1] &&
1409 d->key[2] == other.d->key[2] &&
1410 d->key[3] == other.d->key[3]);
1411}
1412
1420size_t qHash(const QKeySequence &key, size_t seed) noexcept
1421{
1422 return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
1423}
1424
1438{
1439 return std::lexicographical_compare(d->key, d->key + QKeySequencePrivate::MaxKeyCount,
1441}
1442
1474{
1475 return d->ref.loadRelaxed() == 1;
1476}
1477
1500{
1501 QString finalString;
1502 // A standard string, with no translation or anything like that. In some ways it will
1503 // look like our latin case on Windows and X11
1504 int end = count();
1505 for (int i = 0; i < end; ++i) {
1506 finalString += d->encodeString(QKeyCombination::fromCombined(d->key[i]), format);
1507 finalString += ", "_L1;
1508 }
1509 finalString.truncate(finalString.size() - 2);
1510 return finalString;
1511}
1512
1524
1534{
1535 QList<QKeySequence> result;
1536
1537 const QStringList strings = str.split("; "_L1);
1538 result.reserve(strings.size());
1539 for (const QString &string : strings) {
1540 result << fromString(string, format);
1541 }
1542
1543 return result;
1544}
1545
1555{
1557
1558 for (const QKeySequence &sequence : list) {
1559 result += sequence.toString(format);
1560 result += "; "_L1;
1561 }
1562 result.truncate(result.size() - 2);
1563
1564 return result;
1565}
1566
1567/*****************************************************************************
1568 QKeySequence stream functions
1569 *****************************************************************************/
1570#if !defined(QT_NO_DATASTREAM)
1580{
1581 static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
1582 const bool extended = s.version() >= 5 && keysequence.count() > 1;
1583 s << quint32(extended ? 4 : 1) << quint32(keysequence.d->key[0]);
1584 if (extended) {
1585 s << quint32(keysequence.d->key[1])
1586 << quint32(keysequence.d->key[2])
1587 << quint32(keysequence.d->key[3]);
1588 }
1589 return s;
1590}
1591
1592
1602{
1604 quint32 c;
1605 s >> c;
1606 quint32 keys[MaxKeys] = {0};
1607 for (uint i = 0; i < qMin(c, MaxKeys); ++i) {
1608 if (s.atEnd()) {
1609 qWarning("Premature EOF while reading QKeySequence");
1610 return s;
1611 }
1612 s >> keys[i];
1613 }
1614 qAtomicDetach(keysequence.d);
1615 std::copy(keys, keys + MaxKeys, QT_MAKE_CHECKED_ARRAY_ITERATOR(keysequence.d->key, MaxKeys));
1616 return s;
1617}
1618
1619#endif //QT_NO_DATASTREAM
1620
1621#ifndef QT_NO_DEBUG_STREAM
1623{
1624 QDebugStateSaver saver(dbg);
1625 dbg.nospace() << "QKeySequence(" << p.toString() << ')';
1626 return dbg;
1627}
1628#endif
1629
1641
1642#include "moc_qkeysequence.cpp"
bool ref() noexcept
bool deref() noexcept
T loadRelaxed() const noexcept
\inmodule QtCore
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore\reentrant
Definition qdatastream.h:46
int version() const
Returns the version number of the data serialization format.
\inmodule QtCore
\inmodule QtCore
static QPlatformTheme * platformTheme()
constexpr Qt::Key key() const noexcept
static constexpr QKeyCombination fromCombined(int combined)
constexpr int toCombined() const noexcept
constexpr Qt::KeyboardModifiers keyboardModifiers() const noexcept
int key[MaxKeyCount]
static QString encodeString(QKeyCombination keyCombination, QKeySequence::SequenceFormat format)
static constexpr int MaxKeyCount
static Q_GUI_EXPORT QString keyName(Qt::Key key, QKeySequence::SequenceFormat format)
static QKeyCombination decodeString(QString accel, QKeySequence::SequenceFormat format)
The QKeySequence class encapsulates a key sequence as used by shortcuts.
~QKeySequence()
Destroys the key sequence.
SequenceMatch matches(const QKeySequence &seq) const
Matches the sequence with seq.
QKeySequence & operator=(const QKeySequence &other)
Move-assigns other to this QKeySequence instance.
static QKeySequence mnemonic(const QString &text)
Returns the shortcut key sequence for the mnemonic in text, or an empty key sequence if no mnemonics ...
bool operator<(const QKeySequence &ks) const
Provides an arbitrary comparison of this key sequence and other key sequence.
SequenceMatch
\value NoMatch The key sequences are different; not even partially matching.
static QKeySequence fromString(const QString &str, SequenceFormat format=PortableText)
int count() const
Returns the number of keys in the key sequence.
static QList< QKeySequence > keyBindings(StandardKey key)
bool isDetached() const
static QList< QKeySequence > listFromString(const QString &str, SequenceFormat format=PortableText)
SequenceFormat
\value NativeText The key sequence as a platform specific string.
QKeyCombination operator[](uint i) const
Returns a reference to the element at position index in the key sequence.
static QString listToString(const QList< QKeySequence > &list, SequenceFormat format=PortableText)
bool isEmpty() const
Returns true if the key sequence is empty; otherwise returns false.
bool operator==(const QKeySequence &other) const
Returns true if this key sequence is equal to the other key sequence; otherwise returns false.
QString toString(SequenceFormat format=PortableText) const
QKeySequence()
Constructs an empty key sequence.
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:78
constexpr QStringView mid(qsizetype pos, qsizetype n=-1) const noexcept
Returns the substring of length length starting at position start in this object.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString left(qsizetype n) const &
Definition qstring.h:363
qsizetype indexOf(QLatin1StringView s, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition qstring.cpp:4517
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5871
QStringList split(const QString &sep, Qt::SplitBehavior behavior=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
Definition qstring.cpp:8218
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
qsizetype size() const noexcept
Returns the number of characters in this string.
Definition qstring.h:186
QString right(qsizetype n) const &
Definition qstring.h:375
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Definition qstring.h:1226
QString toUpper() const &
Definition qstring.h:439
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
EGLImageKHR int int EGLuint64KHR * modifiers
QString str
[2]
QString text
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
@ CTRL
@ META
@ SHIFT
@ ALT
@ Key_PreviousCandidate
Definition qnamespace.h:744
@ Key_Escape
Definition qnamespace.h:663
@ Key_Memo
Definition qnamespace.h:898
@ Key_Community
Definition qnamespace.h:906
@ Key_LastNumberRedial
@ Key_TouchpadOn
Definition qnamespace.h:986
@ Key_BassBoost
Definition qnamespace.h:853
@ Key_Terminal
Definition qnamespace.h:950
@ Key_Katakana
Definition qnamespace.h:757
@ Key_Yes
@ Key_Favorites
Definition qnamespace.h:866
@ Key_Copy
Definition qnamespace.h:917
@ Key_PowerDown
Definition qnamespace.h:977
@ Key_MediaPrevious
Definition qnamespace.h:860
@ Key_Tab
Definition qnamespace.h:664
@ Key_ZoomIn
Definition qnamespace.h:956
@ Key_LaunchMail
Definition qnamespace.h:870
@ Key_Hibernate
Definition qnamespace.h:974
@ Key_Select
@ Key_ZoomOut
Definition qnamespace.h:957
@ Key_Yellow
Definition qnamespace.h:993
@ Key_Book
Definition qnamespace.h:911
@ Key_MailForward
Definition qnamespace.h:961
@ Key_Shift
Definition qnamespace.h:683
@ Key_Return
Definition qnamespace.h:667
@ Key_Support
Definition qnamespace.h:948
@ Key_LaunchG
Definition qnamespace.h:982
@ Key_Hangul_End
Definition qnamespace.h:779
@ Key_Context2
@ Key_TouchpadOff
Definition qnamespace.h:987
@ Key_Launch5
Definition qnamespace.h:877
@ Key_Context1
@ Key_KeyboardBrightnessUp
Definition qnamespace.h:891
@ Key_Right
Definition qnamespace.h:679
@ Key_Hangul
Definition qnamespace.h:777
@ Key_Enter
Definition qnamespace.h:668
@ Key_MultipleCandidate
Definition qnamespace.h:743
@ Key_Documents
Definition qnamespace.h:921
@ Key_Eisu_toggle
Definition qnamespace.h:767
@ Key_PageUp
Definition qnamespace.h:681
@ Key_Printer
@ Key_Execute
@ Key_Cancel
@ Key_Space
Definition qnamespace.h:513
@ Key_ChannelDown
Definition qnamespace.h:997
@ Key_Tools
Definition qnamespace.h:951
@ Key_MediaTogglePlayPause
Definition qnamespace.h:864
@ Key_Hangup
@ Key_OfficeHome
Definition qnamespace.h:934
@ Key_MenuKB
Definition qnamespace.h:930
@ Key_Bluetooth
Definition qnamespace.h:965
@ Key_Hangul_Start
Definition qnamespace.h:778
@ Key_Video
Definition qnamespace.h:953
@ Key_Hankaku
Definition qnamespace.h:760
@ Key_Music
Definition qnamespace.h:963
@ Key_ToDoList
Definition qnamespace.h:914
@ Key_Hangul_PreHanja
Definition qnamespace.h:786
@ Key_UWB
Definition qnamespace.h:967
@ Key_Go
Definition qnamespace.h:925
@ Key_Game
Definition qnamespace.h:924
@ Key_LaunchF
Definition qnamespace.h:887
@ Key_Open
@ Key_MonBrightnessUp
Definition qnamespace.h:888
@ Key_Eisu_Shift
Definition qnamespace.h:766
@ Key_PowerOff
Definition qnamespace.h:893
@ Key_Exit
@ Key_Undo
@ Key_Context3
@ Key_WebCam
Definition qnamespace.h:960
@ Key_MenuPB
Definition qnamespace.h:931
@ Key_Market
Definition qnamespace.h:928
@ Key_Zenkaku
Definition qnamespace.h:759
@ Key_News
Definition qnamespace.h:933
@ Key_Launch9
Definition qnamespace.h:881
@ Key_Battery
Definition qnamespace.h:964
@ Key_F35
Definition qnamespace.h:724
@ Key_Kana_Lock
Definition qnamespace.h:764
@ Key_Backspace
Definition qnamespace.h:666
@ Key_VolumeUp
Definition qnamespace.h:852
@ Key_Backtab
Definition qnamespace.h:665
@ Key_VolumeDown
Definition qnamespace.h:850
@ Key_HomePage
Definition qnamespace.h:865
@ Key_Launch6
Definition qnamespace.h:878
@ Key_Zenkaku_Hankaku
Definition qnamespace.h:761
@ Key_Insert
Definition qnamespace.h:669
@ Key_New
@ Key_DOS
Definition qnamespace.h:920
@ Key_LaunchA
Definition qnamespace.h:882
@ Key_Touroku
Definition qnamespace.h:762
@ Key_Pictures
Definition qnamespace.h:962
@ Key_Guide
Definition qnamespace.h:999
@ Key_View
Definition qnamespace.h:975
@ Key_Subtitle
Definition qnamespace.h:971
@ Key_AudioRepeat
Definition qnamespace.h:969
@ Key_Launch7
Definition qnamespace.h:879
@ Key_Left
Definition qnamespace.h:677
@ Key_Cut
Definition qnamespace.h:918
@ Key_LaunchH
Definition qnamespace.h:983
@ Key_WakeUp
Definition qnamespace.h:894
@ Key_Hangul_PostHanja
Definition qnamespace.h:787
@ Key_MicVolumeDown
@ Key_ClearGrab
Definition qnamespace.h:915
@ Key_Control
Definition qnamespace.h:684
@ Key_ApplicationLeft
Definition qnamespace.h:909
@ Key_Redo
@ Key_Launch3
Definition qnamespace.h:875
@ Key_AddFavorite
Definition qnamespace.h:902
@ Key_AudioRewind
Definition qnamespace.h:907
@ Key_TouchpadToggle
Definition qnamespace.h:985
@ Key_Alt
Definition qnamespace.h:686
@ Key_LightBulb
Definition qnamespace.h:899
@ Key_BackForward
Definition qnamespace.h:908
@ Key_MySites
Definition qnamespace.h:932
@ Key_VolumeMute
Definition qnamespace.h:851
@ Key_Phone
Definition qnamespace.h:937
@ Key_Hangul_Special
Definition qnamespace.h:791
@ Key_Find
@ Key_Excel
Definition qnamespace.h:922
@ Key_Messenger
Definition qnamespace.h:959
@ Key_Hangul_Banja
Definition qnamespace.h:785
@ Key_SysReq
Definition qnamespace.h:673
@ Key_Meeting
Definition qnamespace.h:929
@ Key_ApplicationRight
Definition qnamespace.h:910
@ Key_Xfer
Definition qnamespace.h:955
@ Key_LaunchD
Definition qnamespace.h:885
@ Key_ChannelUp
Definition qnamespace.h:996
@ Key_Reload
Definition qnamespace.h:940
@ Key_Print
Definition qnamespace.h:672
@ Key_Pause
Definition qnamespace.h:671
@ Key_ContrastAdjust
Definition qnamespace.h:979
@ Key_AudioCycleTrack
Definition qnamespace.h:972
@ Key_MicVolumeUp
@ Key_BrightnessAdjust
Definition qnamespace.h:904
@ Key_Finance
Definition qnamespace.h:905
@ Key_Kanji
Definition qnamespace.h:751
@ Key_Calendar
Definition qnamespace.h:938
@ Key_ScreenSaver
Definition qnamespace.h:896
@ Key_Up
Definition qnamespace.h:678
@ Key_RotateWindows
Definition qnamespace.h:941
@ Key_TrebleUp
Definition qnamespace.h:856
@ Key_TrebleDown
Definition qnamespace.h:857
@ Key_MonBrightnessDown
Definition qnamespace.h:889
@ Key_Hiragana_Katakana
Definition qnamespace.h:758
@ Key_Info
@ Key_SplitScreen
Definition qnamespace.h:947
@ Key_CameraFocus
@ Key_Kana_Shift
Definition qnamespace.h:765
@ Key_Down
Definition qnamespace.h:680
@ Key_Shop
Definition qnamespace.h:900
@ Key_LaunchMedia
Definition qnamespace.h:871
@ Key_Close
Definition qnamespace.h:916
@ Key_Option
Definition qnamespace.h:935
@ Key_Red
Definition qnamespace.h:991
@ Key_MediaPause
Definition qnamespace.h:863
@ Key_Refresh
Definition qnamespace.h:849
@ Key_Spell
Definition qnamespace.h:946
@ Key_Save
Definition qnamespace.h:944
@ Key_BassUp
Definition qnamespace.h:854
@ Key_Launch2
Definition qnamespace.h:874
@ Key_Delete
Definition qnamespace.h:670
@ Key_NumLock
Definition qnamespace.h:688
@ Key_Meta
Definition qnamespace.h:685
@ Key_Forward
Definition qnamespace.h:847
@ Key_Standby
Definition qnamespace.h:868
@ Key_Hangul_Romaja
Definition qnamespace.h:782
@ Key_RotationKB
Definition qnamespace.h:943
@ Key_Launch4
Definition qnamespace.h:876
@ Key_Launch0
Definition qnamespace.h:872
@ Key_Settings
@ Key_Help
Definition qnamespace.h:730
@ Key_Travel
Definition qnamespace.h:952
@ Key_ScrollLock
Definition qnamespace.h:689
@ Key_Send
Definition qnamespace.h:945
@ Key_Sleep
@ Key_Eject
Definition qnamespace.h:895
@ Key_Hiragana
Definition qnamespace.h:756
@ Key_MediaRecord
Definition qnamespace.h:862
@ Key_LaunchB
Definition qnamespace.h:883
@ Key_F1
Definition qnamespace.h:690
@ Key_Henkan
Definition qnamespace.h:754
@ Key_History
Definition qnamespace.h:901
@ Key_WLAN
Definition qnamespace.h:966
@ Key_Green
Definition qnamespace.h:992
@ Key_Play
@ Key_Calculator
Definition qnamespace.h:913
@ Key_RotationPB
Definition qnamespace.h:942
@ Key_Word
Definition qnamespace.h:954
@ Key_Menu
Definition qnamespace.h:727
@ Key_LaunchC
Definition qnamespace.h:884
@ Key_BassDown
Definition qnamespace.h:855
@ Key_Muhenkan
Definition qnamespace.h:752
@ Key_PageDown
Definition qnamespace.h:682
@ Key_TaskPane
Definition qnamespace.h:949
@ Key_AudioRandomPlay
Definition qnamespace.h:970
@ Key_Codeinput
Definition qnamespace.h:741
@ Key_Launch1
Definition qnamespace.h:873
@ Key_Back
Definition qnamespace.h:846
@ Key_Home
Definition qnamespace.h:675
@ Key_Hangul_Jeonja
Definition qnamespace.h:784
@ Key_Away
Definition qnamespace.h:958
@ Key_KeyboardBrightnessDown
Definition qnamespace.h:892
@ Key_Camera
@ Key_LaunchE
Definition qnamespace.h:886
@ Key_WWW
Definition qnamespace.h:897
@ Key_Clear
Definition qnamespace.h:674
@ Key_Massyo
Definition qnamespace.h:763
@ Key_KeyboardLightOnOff
Definition qnamespace.h:890
@ Key_Context4
@ Key_MediaStop
Definition qnamespace.h:859
@ Key_TopMenu
Definition qnamespace.h:976
@ Key_Hangul_Hanja
Definition qnamespace.h:780
@ Key_Call
@ Key_HotLinks
Definition qnamespace.h:903
@ Key_CapsLock
Definition qnamespace.h:687
@ Key_Zoom
@ Key_Suspend
Definition qnamespace.h:978
@ Key_Time
Definition qnamespace.h:973
@ Key_MicMute
Definition qnamespace.h:989
@ Key_MediaPlay
Definition qnamespace.h:858
@ Key_Hangul_Jamo
Definition qnamespace.h:781
@ Key_Search
Definition qnamespace.h:867
@ Key_Paste
Definition qnamespace.h:936
@ Key_LogOff
Definition qnamespace.h:927
@ Key_Stop
Definition qnamespace.h:848
@ Key_Blue
Definition qnamespace.h:994
@ Key_unknown
@ Key_CD
Definition qnamespace.h:912
@ Key_Display
Definition qnamespace.h:919
@ Key_Romaji
Definition qnamespace.h:755
@ Key_Reply
Definition qnamespace.h:939
@ Key_Explorer
Definition qnamespace.h:923
@ Key_OpenUrl
Definition qnamespace.h:869
@ Key_Launch8
Definition qnamespace.h:880
@ Key_AudioForward
Definition qnamespace.h:968
@ Key_MediaNext
Definition qnamespace.h:861
@ Key_End
Definition qnamespace.h:676
@ Key_ToggleCallHangup
@ Key_VoiceDial
@ Key_No
@ Key_iTouch
Definition qnamespace.h:926
@ Key_Flip
@ ShiftModifier
@ ControlModifier
@ MetaModifier
@ KeypadModifier
@ AltModifier
@ AA_MacDontSwapCtrlAndMeta
Definition qnamespace.h:432
constexpr bool is_sorted(ForwardIterator first, ForwardIterator last, BinaryPredicate p={})
QT_WARNING_POP void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
Definition qatomic.h:180
void qAtomicDetach(T *&d)
This is a helper for the detach method of implicitly shared classes.
Definition qatomic.h:199
#define QT_MAKE_CHECKED_ARRAY_ITERATOR(x, N)
#define qApp
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter * sub
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
size_t qHashRange(InputIterator first, InputIterator last, size_t seed=0) noexcept(noexcept(qHash(*first)))
static Q_CONSTINIT bool qt_sequence_no_mnemonics
int key
QDataStream & operator>>(QDataStream &s, QKeySequence &keysequence)
static constexpr int numKeyNames
void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b)
QDataStream & operator<<(QDataStream &s, const QKeySequence &keysequence)
static constexpr struct @196 keyname[]
static void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
#define qWarning
Definition qlogging.h:166
return ret
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
GLboolean GLboolean GLboolean b
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint GLuint end
GLsizei const GLchar ** strings
[1]
GLuint name
GLfloat n
GLint GLsizei GLsizei GLenum format
GLdouble s
[6]
Definition qopenglext.h:235
const GLubyte * c
GLuint entry
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
static QString qtKey(CFStringRef cfkey)
static QString keyName(const QString &rKey)
#define qPrintable(string)
Definition qstring.h:1531
#define k1
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
#define QT_TRANSLATE_NOOP(scope, x)
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
unsigned int quint32
Definition qtypes.h:50
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
unsigned short ushort
Definition qtypes.h:33
QList< int > list
[14]
QStringList keys
QString decodeString(QCborStreamReader &reader)
[26]
QSharedPointer< T > other(t)
[5]
QModifKeyName(int q, QChar n)
QModifKeyName(int q, const QString &n)