/src/qtbase/src/gui/kernel/qkeysequence_p.h
Line | Count | Source |
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 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QKEYSEQUENCE_P_H |
6 | | #define QKEYSEQUENCE_P_H |
7 | | |
8 | | // |
9 | | // W A R N I N G |
10 | | // ------------- |
11 | | // |
12 | | // This file is not part of the Qt API. It exists for the convenience |
13 | | // of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header |
14 | | // file may change from version to version without notice, or even be removed. |
15 | | // |
16 | | // We mean it. |
17 | | // |
18 | | |
19 | | #include <QtGui/private/qtguiglobal_p.h> |
20 | | #include "qkeysequence.h" |
21 | | |
22 | | #include <algorithm> |
23 | | |
24 | | QT_REQUIRE_CONFIG(shortcut); |
25 | | |
26 | | QT_BEGIN_NAMESPACE |
27 | | |
28 | | struct QKeyBinding |
29 | | { |
30 | | QKeySequence::StandardKey standardKey; |
31 | | uchar priority; |
32 | | QKeyCombination shortcut; |
33 | | uint platform; |
34 | | }; |
35 | | |
36 | | class QKeySequencePrivate |
37 | | { |
38 | | public: |
39 | | static constexpr int MaxKeyCount = 4 ; // also used in QKeySequenceEdit |
40 | 0 | constexpr QKeySequencePrivate() : ref(1), key{} {} |
41 | 0 | inline QKeySequencePrivate(const QKeySequencePrivate ©) : ref(1) |
42 | 0 | { |
43 | 0 | std::copy(copy.key, copy.key + MaxKeyCount, |
44 | | QT_MAKE_CHECKED_ARRAY_ITERATOR(key, MaxKeyCount)); |
45 | 0 | } |
46 | | QAtomicInt ref; |
47 | | int key[MaxKeyCount]; |
48 | | static QString encodeString(QKeyCombination keyCombination, QKeySequence::SequenceFormat format); |
49 | | // used in dbusmenu |
50 | | Q_GUI_EXPORT static QString keyName(Qt::Key key, QKeySequence::SequenceFormat format); |
51 | | static QKeyCombination decodeString(QString accel, QKeySequence::SequenceFormat format); |
52 | | }; |
53 | | |
54 | | QT_END_NAMESPACE |
55 | | |
56 | | #endif //QKEYSEQUENCE_P_H |