Qt 6.x
The Qt SDK
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.size() > 0) {
788 d = bindings.first().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
826{
827 d = new QKeySequencePrivate();
828 assign(key, format);
829}
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);
1022 ++n;
1023 }
1024 return n;
1025}
1026
1030 QModifKeyName(int q, const QString &n) : qt_key(q), name(n) { }
1033};
1035
1037Q_GLOBAL_STATIC(QList<QModifKeyName>, globalPortableModifs)
1038
1039
1042int QKeySequence::decodeString(const QString &str)
1043{
1045}
1046
1048{
1049 Q_ASSERT(!accel.isEmpty());
1050
1051 int ret = 0;
1052 accel = std::move(accel).toLower();
1053 bool nativeText = (format == QKeySequence::NativeText);
1054
1055 QList<QModifKeyName> *gmodifs;
1056 if (nativeText) {
1057 gmodifs = globalModifs();
1058 if (gmodifs->isEmpty()) {
1059#if defined(Q_OS_APPLE)
1060 const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
1061 if (dontSwap)
1062 *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
1063 else
1064 *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode));
1065 *gmodifs << QModifKeyName(Qt::ALT, QChar(kOptionUnicode));
1066 if (dontSwap)
1067 *gmodifs << QModifKeyName(Qt::CTRL, QChar(kControlUnicode));
1068 else
1069 *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
1070 *gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode));
1071#endif
1072 *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
1073 << QModifKeyName(Qt::SHIFT, u"shift+"_s)
1074 << QModifKeyName(Qt::ALT, u"alt+"_s)
1075 << QModifKeyName(Qt::META, u"meta+"_s)
1076 << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
1077 }
1078 } else {
1079 gmodifs = globalPortableModifs();
1080 if (gmodifs->isEmpty()) {
1081 *gmodifs << QModifKeyName(Qt::CTRL, u"ctrl+"_s)
1082 << QModifKeyName(Qt::SHIFT, u"shift+"_s)
1083 << QModifKeyName(Qt::ALT, u"alt+"_s)
1084 << QModifKeyName(Qt::META, u"meta+"_s)
1085 << QModifKeyName(Qt::KeypadModifier, u"num+"_s);
1086 }
1087 }
1088
1089
1090 QList<QModifKeyName> modifs;
1091 if (nativeText) {
1092 modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(u'+'))
1093 << QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(u'+'))
1094 << QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(u'+'))
1095 << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(u'+'))
1096 << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Num").toLower().append(u'+'));
1097 }
1098 modifs += *gmodifs; // Test non-translated ones last
1099
1100 QString sl = accel;
1101#if defined(Q_OS_APPLE)
1102 for (int i = 0; i < modifs.size(); ++i) {
1103 const QModifKeyName &mkf = modifs.at(i);
1104 if (sl.contains(mkf.name)) {
1105 ret |= mkf.qt_key;
1106 accel.remove(mkf.name);
1107 sl = accel;
1108 }
1109 }
1110 if (accel.isEmpty()) // Incomplete, like for "Meta+Shift+"
1111 return Qt::Key_unknown;
1112#endif
1113
1114 qsizetype i = 0;
1115 qsizetype lastI = 0;
1116 while ((i = sl.indexOf(u'+', i + 1)) != -1) {
1117 const QStringView sub = QStringView{sl}.mid(lastI, i - lastI + 1);
1118 // If we get here the shortcuts contains at least one '+'. We break up
1119 // along the following strategy:
1120 // Meta+Ctrl++ ( "Meta+", "Ctrl+", "+" )
1121 // Super+Shift+A ( "Super+", "Shift+" )
1122 // 4+3+2=1 ( "4+", "3+" )
1123 // In other words, everything we try to handle HAS to be a modifier
1124 // except for a single '+' at the end of the string.
1125
1126 // Only '+' can have length 1.
1127 if (sub.size() == 1) {
1128 // Make sure we only encounter a single '+' at the end of the accel
1129 if (accel.lastIndexOf(u'+') != accel.size()-1)
1130 return Qt::Key_unknown;
1131 } else {
1132 // Identify the modifier
1133 bool validModifier = false;
1134 for (int j = 0; j < modifs.size(); ++j) {
1135 const QModifKeyName &mkf = modifs.at(j);
1136 if (sub == mkf.name) {
1137 ret |= mkf.qt_key;
1138 validModifier = true;
1139 break; // Shortcut, since if we find an other it would/should just be a dup
1140 }
1141 }
1142
1143 if (!validModifier)
1144 return Qt::Key_unknown;
1145 }
1146 lastI = i + 1;
1147 }
1148
1149 qsizetype p = accel.lastIndexOf(u'+', accel.size() - 2); // -2 so that Ctrl++ works
1150 QStringView accelRef(accel);
1151 if (p > 0)
1152 accelRef = accelRef.mid(p + 1);
1153
1154 int fnum = 0;
1155 if (accelRef.size() == 1) {
1156#if defined(Q_OS_APPLE)
1157 int qtKey = qtkeyForAppleSymbol(accelRef.at(0));
1158 if (qtKey != -1) {
1159 ret |= qtKey;
1160 } else
1161#endif
1162 {
1163 ret |= accelRef.at(0).toUpper().unicode();
1164 }
1165 } else if (accelRef.at(0) == u'f' && (fnum = accelRef.mid(1).toInt()) >= 1 && fnum <= 35) {
1166 ret |= Qt::Key_F1 + fnum - 1;
1167 } else {
1168 // For NativeText, check the translation table first,
1169 // if we don't find anything then try it out with just the untranlated stuff.
1170 // PortableText will only try the untranlated table.
1171 bool found = false;
1172 for (int tran = 0; tran < 2; ++tran) {
1173 if (!nativeText)
1174 ++tran;
1175 for (int i = 0; i < numKeyNames; ++i) {
1176 QString keyName(tran == 0
1177 ? QCoreApplication::translate("QShortcut", keyname[i].name)
1179 if (accelRef == std::move(keyName).toLower()) {
1180 ret |= keyname[i].key;
1181 found = true;
1182 break;
1183 }
1184 }
1185 if (found)
1186 break;
1187 }
1188 // We couldn't translate the key.
1189 if (!found)
1190 return Qt::Key_unknown;
1191 }
1192 return ret;
1193}
1194
1200QString QKeySequence::encodeString(int key)
1201{
1203}
1204
1205static inline void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
1206{
1207 if (!str.isEmpty()) {
1209 //: Key separator in shortcut string
1210 str += QCoreApplication::translate("QShortcut", "+");
1211 } else {
1212 str += u'+';
1213 }
1214 }
1215
1216 str += theKey;
1217}
1218
1220{
1221 bool nativeText = (format == QKeySequence::NativeText);
1222 QString s;
1223
1224 // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
1225 if (key == -1 || key == Qt::Key_unknown)
1226 return s;
1227
1228#if defined(Q_OS_APPLE)
1229 if (nativeText) {
1230 // On Apple platforms the order (by default) is Meta, Alt, Shift, Control.
1231 // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
1232 // is Ctrl, Alt, Shift, Meta. The appleSymbolForQtKey helper does this swap
1233 // for us, which means that we have to adjust our order here.
1234 // The upshot is a lot more infrastructure to keep the number of
1235 // if tests down and the code relatively clean.
1236 static constexpr int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 };
1237 static constexpr int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 };
1238 static constexpr int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 };
1239 static constexpr int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 };
1240 const int *modifierOrder;
1241 const int *qtkeyOrder;
1242 if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
1243 modifierOrder = DontSwapModifierOrder;
1244 qtkeyOrder = DontSwapQtKeyOrder;
1245 } else {
1246 modifierOrder = ModifierOrder;
1247 qtkeyOrder = QtKeyOrder;
1248 }
1249
1250 for (int i = 0; modifierOrder[i] != 0; ++i) {
1251 if (key & modifierOrder[i])
1252 s += appleSymbolForQtKey(qtkeyOrder[i]);
1253 }
1254 } else
1255#endif
1256 {
1257 // On other systems the order is Meta, Control, Alt, Shift
1258 if ((key & Qt::META) == Qt::META)
1259 s = nativeText ? QCoreApplication::translate("QShortcut", "Meta") : QString::fromLatin1("Meta");
1260 if ((key & Qt::CTRL) == Qt::CTRL)
1261 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Ctrl") : QString::fromLatin1("Ctrl"), format);
1262 if ((key & Qt::ALT) == Qt::ALT)
1263 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
1264 if ((key & Qt::SHIFT) == Qt::SHIFT)
1265 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
1266 }
1268 addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format);
1269
1271
1272#if defined(Q_OS_APPLE)
1273 if (nativeText)
1274 s += p;
1275 else
1276#endif
1277 addKey(s, p, format);
1278 return s;
1279}
1280
1290{
1291 bool nativeText = (format == QKeySequence::NativeText);
1293 QString p;
1294
1295 if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
1298 } else {
1301 }
1302 } else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
1303 p = nativeText ? QCoreApplication::translate("QShortcut", "F%1").arg(key - Qt::Key_F1 + 1)
1304 : QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
1305 } else if (key) {
1306 int i=0;
1307#if defined(Q_OS_APPLE)
1308 if (nativeText) {
1309 QChar ch = appleSymbolForQtKey(key);
1310 if (!ch.isNull())
1311 p = ch;
1312 else
1313 goto NonSymbol;
1314 } else
1315#endif
1316 {
1317#if defined(Q_OS_APPLE)
1318NonSymbol:
1319#endif
1320 while (i < numKeyNames) {
1321 if (key == keyname[i].key) {
1322 p = nativeText ? QCoreApplication::translate("QShortcut", keyname[i].name)
1324 break;
1325 }
1326 ++i;
1327 }
1328 // If we can't find the actual translatable keyname,
1329 // fall back on the unicode representation of it...
1330 // Or else characters like Qt::Key_aring may not get displayed
1331 // (Really depends on you locale)
1332 if (i >= numKeyNames) {
1335 } else {
1338 }
1339 }
1340 }
1341 }
1342 return p;
1343}
1351{
1352 uint userN = count(),
1353 seqN = seq.count();
1354
1355 if (userN > seqN)
1356 return NoMatch;
1357
1358 // If equal in length, we have a potential ExactMatch sequence,
1359 // else we already know it can only be partial.
1360 SequenceMatch match = (userN == seqN ? ExactMatch : PartialMatch);
1361
1362 for (uint i = 0; i < userN; ++i) {
1363 QKeyCombination userKey = (*this)[i],
1364 sequenceKey = seq[i];
1365 if (userKey != sequenceKey)
1366 return NoMatch;
1367 }
1368 return match;
1369}
1370
1374QKeySequence::operator QVariant() const
1375{
1376 return QVariant::fromValue(*this);
1377}
1378
1384{
1385 Q_ASSERT_X(index < QKeySequencePrivate::MaxKeyCount, "QKeySequence::operator[]", "index out of range");
1387}
1388
1389
1395{
1396 qAtomicAssign(d, other.d);
1397 return *this;
1398}
1399
1421{
1422 return (d->key[0] == other.d->key[0] &&
1423 d->key[1] == other.d->key[1] &&
1424 d->key[2] == other.d->key[2] &&
1425 d->key[3] == other.d->key[3]);
1426}
1427
1435size_t qHash(const QKeySequence &key, size_t seed) noexcept
1436{
1437 return qHashRange(key.d->key, key.d->key + QKeySequencePrivate::MaxKeyCount, seed);
1438}
1439
1453{
1454 return std::lexicographical_compare(d->key, d->key + QKeySequencePrivate::MaxKeyCount,
1456}
1457
1489{
1490 return d->ref.loadRelaxed() == 1;
1491}
1492
1515{
1516 QString finalString;
1517 // A standard string, with no translation or anything like that. In some ways it will
1518 // look like our latin case on Windows and X11
1519 int end = count();
1520 for (int i = 0; i < end; ++i) {
1521 finalString += d->encodeString(d->key[i], format);
1522 finalString += ", "_L1;
1523 }
1524 finalString.truncate(finalString.size() - 2);
1525 return finalString;
1526}
1527
1536{
1537 return QKeySequence(str, format);
1538}
1539
1549{
1551
1552 const QStringList strings = str.split("; "_L1);
1553 result.reserve(strings.size());
1554 for (const QString &string : strings) {
1555 result << fromString(string, format);
1556 }
1557
1558 return result;
1559}
1560
1570{
1572
1573 for (const QKeySequence &sequence : list) {
1574 result += sequence.toString(format);
1575 result += "; "_L1;
1576 }
1577 result.truncate(result.size() - 2);
1578
1579 return result;
1580}
1581
1582/*****************************************************************************
1583 QKeySequence stream functions
1584 *****************************************************************************/
1585#if !defined(QT_NO_DATASTREAM)
1595{
1596 static_assert(QKeySequencePrivate::MaxKeyCount == 4, "Forgot to adapt QDataStream &operator<<(QDataStream &s, const QKeySequence &keysequence) to new QKeySequence::MaxKeyCount");
1597 const bool extended = s.version() >= 5 && keysequence.count() > 1;
1598 s << quint32(extended ? 4 : 1) << quint32(keysequence.d->key[0]);
1599 if (extended) {
1600 s << quint32(keysequence.d->key[1])
1601 << quint32(keysequence.d->key[2])
1602 << quint32(keysequence.d->key[3]);
1603 }
1604 return s;
1605}
1606
1607
1617{
1619 quint32 c;
1620 s >> c;
1621 quint32 keys[MaxKeys] = {0};
1622 for (uint i = 0; i < qMin(c, MaxKeys); ++i) {
1623 if (s.atEnd()) {
1624 qWarning("Premature EOF while reading QKeySequence");
1625 return s;
1626 }
1627 s >> keys[i];
1628 }
1629 qAtomicDetach(keysequence.d);
1630 std::copy(keys, keys + MaxKeys, QT_MAKE_CHECKED_ARRAY_ITERATOR(keysequence.d->key, MaxKeys));
1631 return s;
1632}
1633
1634#endif //QT_NO_DATASTREAM
1635
1636#ifndef QT_NO_DEBUG_STREAM
1638{
1639 QDebugStateSaver saver(dbg);
1640 dbg.nospace() << "QKeySequence(" << p.toString() << ')';
1641 return dbg;
1642}
1643#endif
1644
1656
1657#include "moc_qkeysequence.cpp"
bool ref() noexcept
bool deref() noexcept
T loadRelaxed() const noexcept
\inmodule QtCore
Definition qchar.h:48
static constexpr QChar fromUcs2(char16_t c) noexcept
Definition qchar.h:98
static constexpr bool requiresSurrogates(char32_t ucs4) noexcept
Returns true if the UCS-4-encoded character specified by ucs4 can be split into the high and low part...
Definition qchar.h:504
static constexpr char16_t highSurrogate(char32_t ucs4) noexcept
Returns the high surrogate part of a UCS-4-encoded code point.
Definition qchar.h:518
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
Definition qchar.h:458
static constexpr char16_t lowSurrogate(char32_t ucs4) noexcept
Returns the low surrogate part of a UCS-4-encoded code point.
Definition qchar.h:522
QChar toUpper() const noexcept
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
Definition qchar.h:449
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
\inmodule QtCore\reentrant
Definition qdatastream.h:30
int version() const
Returns the version number of the data serialization format.
\inmodule QtCore
\inmodule QtCore
static QPlatformTheme * platformTheme()
static constexpr QKeyCombination fromCombined(int combined)
int key[MaxKeyCount]
static Q_GUI_EXPORT QString keyName(int key, QKeySequence::SequenceFormat format)
static QString encodeString(int key, QKeySequence::SequenceFormat format)
static int 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.
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
bool isEmpty() const noexcept
Definition qlist.h:390
T & first()
Definition qlist.h:628
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
\inmodule QtCore
\inmodule QtCore
Definition qstringview.h:76
constexpr qsizetype size() const noexcept
Returns the size of this string view, in UTF-16 code units (that is, surrogate pairs count as two for...
int toInt(bool *ok=nullptr, int base=10) const
Returns the string view converted to an int using base base, which is 10 by default and must be betwe...
Definition qstring.h:1025
constexpr QChar at(qsizetype n) const noexcept
Returns the character at position n in this string view.
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:127
QString right(qsizetype n) const
Returns a substring that contains the n rightmost characters of the string.
Definition qstring.cpp:5180
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Definition qstring.h:279
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5710
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:7956
void truncate(qsizetype pos)
Truncates the string at the given position index.
Definition qstring.cpp:6159
qsizetype size() const
Returns the number of characters in this string.
Definition qstring.h:182
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8606
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
Definition qstring.cpp:5204
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
Definition qstring.h:1079
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QString toLower() const &
Definition qstring.h:368
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition qstring.h:1217
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
Definition qstring.cpp:5161
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition qstring.cpp:4420
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition qstring.cpp:3435
\inmodule QtCore
Definition qvariant.h:64
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:531
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:739
@ Key_Escape
Definition qnamespace.h:658
@ Key_Memo
Definition qnamespace.h:893
@ Key_Community
Definition qnamespace.h:901
@ Key_LastNumberRedial
@ Key_TouchpadOn
Definition qnamespace.h:981
@ Key_BassBoost
Definition qnamespace.h:848
@ Key_Terminal
Definition qnamespace.h:945
@ Key_Katakana
Definition qnamespace.h:752
@ Key_Yes
@ Key_Favorites
Definition qnamespace.h:861
@ Key_Copy
Definition qnamespace.h:912
@ Key_PowerDown
Definition qnamespace.h:972
@ Key_MediaPrevious
Definition qnamespace.h:855
@ Key_Tab
Definition qnamespace.h:659
@ Key_ZoomIn
Definition qnamespace.h:951
@ Key_LaunchMail
Definition qnamespace.h:865
@ Key_Hibernate
Definition qnamespace.h:969
@ Key_Select
@ Key_ZoomOut
Definition qnamespace.h:952
@ Key_Yellow
Definition qnamespace.h:988
@ Key_Book
Definition qnamespace.h:906
@ Key_MailForward
Definition qnamespace.h:956
@ Key_Shift
Definition qnamespace.h:678
@ Key_Return
Definition qnamespace.h:662
@ Key_Support
Definition qnamespace.h:943
@ Key_LaunchG
Definition qnamespace.h:977
@ Key_Hangul_End
Definition qnamespace.h:774
@ Key_Context2
@ Key_TouchpadOff
Definition qnamespace.h:982
@ Key_Launch5
Definition qnamespace.h:872
@ Key_Context1
@ Key_KeyboardBrightnessUp
Definition qnamespace.h:886
@ Key_Right
Definition qnamespace.h:674
@ Key_Hangul
Definition qnamespace.h:772
@ Key_Enter
Definition qnamespace.h:663
@ Key_MultipleCandidate
Definition qnamespace.h:738
@ Key_Documents
Definition qnamespace.h:916
@ Key_Eisu_toggle
Definition qnamespace.h:762
@ Key_PageUp
Definition qnamespace.h:676
@ Key_Printer
@ Key_Execute
@ Key_Cancel
@ Key_Space
Definition qnamespace.h:512
@ Key_ChannelDown
Definition qnamespace.h:992
@ Key_Tools
Definition qnamespace.h:946
@ Key_MediaTogglePlayPause
Definition qnamespace.h:859
@ Key_Hangup
@ Key_OfficeHome
Definition qnamespace.h:929
@ Key_MenuKB
Definition qnamespace.h:925
@ Key_Bluetooth
Definition qnamespace.h:960
@ Key_Hangul_Start
Definition qnamespace.h:773
@ Key_Video
Definition qnamespace.h:948
@ Key_Hankaku
Definition qnamespace.h:755
@ Key_Music
Definition qnamespace.h:958
@ Key_ToDoList
Definition qnamespace.h:909
@ Key_Hangul_PreHanja
Definition qnamespace.h:781
@ Key_UWB
Definition qnamespace.h:962
@ Key_Go
Definition qnamespace.h:920
@ Key_Game
Definition qnamespace.h:919
@ Key_LaunchF
Definition qnamespace.h:882
@ Key_Open
@ Key_MonBrightnessUp
Definition qnamespace.h:883
@ Key_Eisu_Shift
Definition qnamespace.h:761
@ Key_PowerOff
Definition qnamespace.h:888
@ Key_Exit
@ Key_Undo
@ Key_Context3
@ Key_WebCam
Definition qnamespace.h:955
@ Key_MenuPB
Definition qnamespace.h:926
@ Key_Market
Definition qnamespace.h:923
@ Key_Zenkaku
Definition qnamespace.h:754
@ Key_News
Definition qnamespace.h:928
@ Key_Launch9
Definition qnamespace.h:876
@ Key_Battery
Definition qnamespace.h:959
@ Key_F35
Definition qnamespace.h:719
@ Key_Kana_Lock
Definition qnamespace.h:759
@ Key_Backspace
Definition qnamespace.h:661
@ Key_VolumeUp
Definition qnamespace.h:847
@ Key_Backtab
Definition qnamespace.h:660
@ Key_VolumeDown
Definition qnamespace.h:845
@ Key_HomePage
Definition qnamespace.h:860
@ Key_Launch6
Definition qnamespace.h:873
@ Key_Zenkaku_Hankaku
Definition qnamespace.h:756
@ Key_Insert
Definition qnamespace.h:664
@ Key_New
@ Key_DOS
Definition qnamespace.h:915
@ Key_LaunchA
Definition qnamespace.h:877
@ Key_Touroku
Definition qnamespace.h:757
@ Key_Pictures
Definition qnamespace.h:957
@ Key_Guide
Definition qnamespace.h:994
@ Key_View
Definition qnamespace.h:970
@ Key_Subtitle
Definition qnamespace.h:966
@ Key_AudioRepeat
Definition qnamespace.h:964
@ Key_Launch7
Definition qnamespace.h:874
@ Key_Left
Definition qnamespace.h:672
@ Key_Cut
Definition qnamespace.h:913
@ Key_LaunchH
Definition qnamespace.h:978
@ Key_WakeUp
Definition qnamespace.h:889
@ Key_Hangul_PostHanja
Definition qnamespace.h:782
@ Key_MicVolumeDown
Definition qnamespace.h:999
@ Key_ClearGrab
Definition qnamespace.h:910
@ Key_Control
Definition qnamespace.h:679
@ Key_ApplicationLeft
Definition qnamespace.h:904
@ Key_Redo
@ Key_Launch3
Definition qnamespace.h:870
@ Key_AddFavorite
Definition qnamespace.h:897
@ Key_AudioRewind
Definition qnamespace.h:902
@ Key_TouchpadToggle
Definition qnamespace.h:980
@ Key_Alt
Definition qnamespace.h:681
@ Key_LightBulb
Definition qnamespace.h:894
@ Key_BackForward
Definition qnamespace.h:903
@ Key_MySites
Definition qnamespace.h:927
@ Key_VolumeMute
Definition qnamespace.h:846
@ Key_Phone
Definition qnamespace.h:932
@ Key_Hangul_Special
Definition qnamespace.h:786
@ Key_Find
@ Key_Excel
Definition qnamespace.h:917
@ Key_Messenger
Definition qnamespace.h:954
@ Key_Hangul_Banja
Definition qnamespace.h:780
@ Key_SysReq
Definition qnamespace.h:668
@ Key_Meeting
Definition qnamespace.h:924
@ Key_ApplicationRight
Definition qnamespace.h:905
@ Key_Xfer
Definition qnamespace.h:950
@ Key_LaunchD
Definition qnamespace.h:880
@ Key_ChannelUp
Definition qnamespace.h:991
@ Key_Reload
Definition qnamespace.h:935
@ Key_Print
Definition qnamespace.h:667
@ Key_Pause
Definition qnamespace.h:666
@ Key_ContrastAdjust
Definition qnamespace.h:974
@ Key_AudioCycleTrack
Definition qnamespace.h:967
@ Key_MicVolumeUp
Definition qnamespace.h:998
@ Key_BrightnessAdjust
Definition qnamespace.h:899
@ Key_Finance
Definition qnamespace.h:900
@ Key_Kanji
Definition qnamespace.h:746
@ Key_Calendar
Definition qnamespace.h:933
@ Key_ScreenSaver
Definition qnamespace.h:891
@ Key_Up
Definition qnamespace.h:673
@ Key_RotateWindows
Definition qnamespace.h:936
@ Key_TrebleUp
Definition qnamespace.h:851
@ Key_TrebleDown
Definition qnamespace.h:852
@ Key_MonBrightnessDown
Definition qnamespace.h:884
@ Key_Hiragana_Katakana
Definition qnamespace.h:753
@ Key_Info
Definition qnamespace.h:995
@ Key_SplitScreen
Definition qnamespace.h:942
@ Key_CameraFocus
@ Key_Kana_Shift
Definition qnamespace.h:760
@ Key_Down
Definition qnamespace.h:675
@ Key_Shop
Definition qnamespace.h:895
@ Key_LaunchMedia
Definition qnamespace.h:866
@ Key_Close
Definition qnamespace.h:911
@ Key_Option
Definition qnamespace.h:930
@ Key_Red
Definition qnamespace.h:986
@ Key_MediaPause
Definition qnamespace.h:858
@ Key_Refresh
Definition qnamespace.h:844
@ Key_Spell
Definition qnamespace.h:941
@ Key_Save
Definition qnamespace.h:939
@ Key_BassUp
Definition qnamespace.h:849
@ Key_Launch2
Definition qnamespace.h:869
@ Key_Delete
Definition qnamespace.h:665
@ Key_NumLock
Definition qnamespace.h:683
@ Key_Meta
Definition qnamespace.h:680
@ Key_Forward
Definition qnamespace.h:842
@ Key_Standby
Definition qnamespace.h:863
@ Key_Hangul_Romaja
Definition qnamespace.h:777
@ Key_RotationKB
Definition qnamespace.h:938
@ Key_Launch4
Definition qnamespace.h:871
@ Key_Launch0
Definition qnamespace.h:867
@ Key_Settings
Definition qnamespace.h:996
@ Key_Help
Definition qnamespace.h:725
@ Key_Travel
Definition qnamespace.h:947
@ Key_ScrollLock
Definition qnamespace.h:684
@ Key_Send
Definition qnamespace.h:940
@ Key_Sleep
@ Key_Eject
Definition qnamespace.h:890
@ Key_Hiragana
Definition qnamespace.h:751
@ Key_MediaRecord
Definition qnamespace.h:857
@ Key_LaunchB
Definition qnamespace.h:878
@ Key_F1
Definition qnamespace.h:685
@ Key_Henkan
Definition qnamespace.h:749
@ Key_History
Definition qnamespace.h:896
@ Key_WLAN
Definition qnamespace.h:961
@ Key_Green
Definition qnamespace.h:987
@ Key_Play
@ Key_Calculator
Definition qnamespace.h:908
@ Key_RotationPB
Definition qnamespace.h:937
@ Key_Word
Definition qnamespace.h:949
@ Key_Menu
Definition qnamespace.h:722
@ Key_LaunchC
Definition qnamespace.h:879
@ Key_BassDown
Definition qnamespace.h:850
@ Key_Muhenkan
Definition qnamespace.h:747
@ Key_PageDown
Definition qnamespace.h:677
@ Key_TaskPane
Definition qnamespace.h:944
@ Key_AudioRandomPlay
Definition qnamespace.h:965
@ Key_Codeinput
Definition qnamespace.h:736
@ Key_Launch1
Definition qnamespace.h:868
@ Key_Back
Definition qnamespace.h:841
@ Key_Home
Definition qnamespace.h:670
@ Key_Hangul_Jeonja
Definition qnamespace.h:779
@ Key_Away
Definition qnamespace.h:953
@ Key_KeyboardBrightnessDown
Definition qnamespace.h:887
@ Key_Camera
@ Key_LaunchE
Definition qnamespace.h:881
@ Key_WWW
Definition qnamespace.h:892
@ Key_Clear
Definition qnamespace.h:669
@ Key_Massyo
Definition qnamespace.h:758
@ Key_KeyboardLightOnOff
Definition qnamespace.h:885
@ Key_Context4
@ Key_MediaStop
Definition qnamespace.h:854
@ Key_TopMenu
Definition qnamespace.h:971
@ Key_Hangul_Hanja
Definition qnamespace.h:775
@ Key_Call
@ Key_HotLinks
Definition qnamespace.h:898
@ Key_CapsLock
Definition qnamespace.h:682
@ Key_Zoom
@ Key_Suspend
Definition qnamespace.h:973
@ Key_Time
Definition qnamespace.h:968
@ Key_MicMute
Definition qnamespace.h:984
@ Key_MediaPlay
Definition qnamespace.h:853
@ Key_Hangul_Jamo
Definition qnamespace.h:776
@ Key_Search
Definition qnamespace.h:862
@ Key_Paste
Definition qnamespace.h:931
@ Key_LogOff
Definition qnamespace.h:922
@ Key_Stop
Definition qnamespace.h:843
@ Key_Blue
Definition qnamespace.h:989
@ Key_unknown
@ Key_CD
Definition qnamespace.h:907
@ Key_Display
Definition qnamespace.h:914
@ Key_Romaji
Definition qnamespace.h:750
@ Key_Reply
Definition qnamespace.h:934
@ Key_Explorer
Definition qnamespace.h:918
@ Key_OpenUrl
Definition qnamespace.h:864
@ Key_Launch8
Definition qnamespace.h:875
@ Key_AudioForward
Definition qnamespace.h:963
@ Key_MediaNext
Definition qnamespace.h:856
@ Key_End
Definition qnamespace.h:671
@ Key_ToggleCallHangup
@ Key_VoiceDial
@ Key_No
@ Key_iTouch
Definition qnamespace.h:921
@ Key_Flip
@ ShiftModifier
@ ControlModifier
@ MetaModifier
@ KeypadModifier
@ AltModifier
@ AA_MacDontSwapCtrlAndMeta
Definition qnamespace.h:431
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 struct @200 keyname[]
static constexpr int numKeyNames
void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b)
QDataStream & operator<<(QDataStream &s, const QKeySequence &keysequence)
static void addKey(QString &str, const QString &theKey, QKeySequence::SequenceFormat format)
#define qWarning
Definition qlogging.h:162
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
const GLubyte * c
GLuint entry
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
GLdouble s
[6]
Definition qopenglext.h:235
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)
#define qPrintable(string)
Definition qstring.h:1391
#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:145
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:163
unsigned int quint32
Definition qtypes.h:45
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
unsigned short ushort
Definition qtypes.h:28
QList< int > list
[14]
QStringList keys
QSharedPointer< T > other(t)
[5]
QModifKeyName(int q, QChar n)
QModifKeyName(int q, const QString &n)