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

source code of qtbase/src/gui/kernel/qkeysequence_p.h