Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qkeymapper.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
// Qt-Security score:significant reason:default
4
5
6
#
include
"qguiapplication.h"
7
8
#
include
<
private
/
qobject_p
.
h
>
9
#
include
"qkeymapper_p.h"
10
11
#
include
<
private
/
qguiapplication_p
.
h
>
12
#
include
<
qpa
/
qplatformintegration
.
h
>
13
#
include
<
qpa
/
qplatformkeymapper
.
h
>
14
15
QT_BEGIN_NAMESPACE
16
17
/*!
18
\class QKeyMapper
19
\since 4.2
20
\internal
21
22
\sa QObject
23
*/
24
25
/*!
26
Constructs a new key mapper.
27
*/
28
QKeyMapper::QKeyMapper() : QObject()
29
{
30
}
31
32
/*!
33
Destroys the key mapper.
34
*/
35
QKeyMapper::~QKeyMapper()
36
{
37
}
38
39
QList<QKeyCombination> QKeyMapper::possibleKeys(
const
QKeyEvent *e)
40
{
41
qCDebug(lcQpaKeyMapper).verbosity(3) <<
"Computing possible key combinations for"
<< e;
42
43
const
auto
*platformIntegration = QGuiApplicationPrivate::platformIntegration();
44
const
auto
*platformKeyMapper = platformIntegration->keyMapper();
45
QList<QKeyCombination> result = platformKeyMapper->possibleKeyCombinations(e);
46
47
if
(result.isEmpty()) {
48
if
(e->key() && (e->key() != Qt::Key_unknown))
49
result << e->keyCombination();
50
else
if
(!e->text().isEmpty())
51
result << (Qt::Key(e->text().at(0).unicode()) | e->modifiers());
52
}
53
54
#
if
QT_CONFIG
(
shortcut
)
55
if
(lcQpaKeyMapper().isDebugEnabled()) {
56
qCDebug(lcQpaKeyMapper) <<
"Resulting possible key combinations:"
;
57
for
(
auto
keyCombination : result) {
58
auto
keySequence = QKeySequence(keyCombination);
59
qCDebug(lcQpaKeyMapper).verbosity(0) <<
"\t-"
60
<< keyCombination <<
"/"
<< keySequence <<
"/"
61
<< qUtf8Printable(keySequence.toString(QKeySequence::NativeText));
62
}
63
}
64
#
endif
65
66
return
result;
67
}
68
69
Q_GLOBAL_STATIC
(QKeyMapper, keymapper)
70
/*!
71
Returns the pointer to the single instance of QKeyMapper in the application.
72
If none yet exists, the function ensures that one is created.
73
*/
74
QKeyMapper *QKeyMapper::instance()
75
{
76
return
keymapper();
77
}
78
79
void
*QKeyMapper::resolveInterface(
const
char
*name,
int
revision)
const
80
{
81
Q_UNUSED(name); Q_UNUSED(revision);
82
using
namespace
QNativeInterface::Private;
83
84
#
if
QT_CONFIG
(
evdev
)
85
QT_NATIVE_INTERFACE_RETURN_IF(QEvdevKeyMapper, QGuiApplicationPrivate::platformIntegration());
86
#
endif
87
88
#
if
QT_CONFIG
(
vxworksevdev
)
89
QT_NATIVE_INTERFACE_RETURN_IF(QVxKeyMapper, QGuiApplicationPrivate::platformIntegration());
90
#
endif
91
92
return
nullptr
;
93
}
94
95
QT_END_NAMESPACE
96
97
#
include
"moc_qkeymapper_p.cpp"
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
Q_GLOBAL_STATIC
Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames, { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, { Qt::EditRole, "edit" }, { Qt::ToolTipRole, "toolTip" }, { Qt::StatusTipRole, "statusTip" }, { Qt::WhatsThisRole, "whatsThis" }, }) const QHash< int
qtbase
src
gui
kernel
qkeymapper.cpp
Generated on
for Qt by
1.18.0