Qt 6.x
The Qt SDK
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
4
5#include "qguiapplication.h"
6
7#include <private/qobject_p.h>
8#include "qkeymapper_p.h"
9
10#include <private/qguiapplication_p.h>
11#include <qpa/qplatformintegration.h>
12
14
28{
29}
30
35{
36}
37
39{
41 if (e->key() && (e->key() != Qt::Key_unknown))
42 result << e->keyCombination().toCombined();
43 else if (!e->text().isEmpty())
44 result << int(e->text().at(0).unicode() + (int)e->modifiers());
45 return result;
46}
47
49{
50 return instance()->d_func()->possibleKeys(e);
51}
52
53extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // in qapplication_*.cpp
55{
56 // ## TODO: Support KeyboardLayoutChange on QPA
57#if 0
58 // inform all toplevel widgets of the change
61 for (int i = 0; i < list.size(); ++i) {
62 QWidget *w = list.at(i);
64 }
65#endif
66}
67
74{
75 return keymapper();
76}
77
79{
80 return QKeyMapper::instance()->d_func();
81}
82
84{
87}
88
90{
91}
92
94{
96 if (!result.isEmpty())
97 return result;
98
99 return extractKeyFromEvent(e);
100}
101
102void *QKeyMapper::resolveInterface(const char *name, int revision) const
103{
104 Q_UNUSED(name); Q_UNUSED(revision);
105 using namespace QNativeInterface::Private;
106
107#if QT_CONFIG(evdev)
109#endif
110
111 return nullptr;
112}
113
115
116#include "moc_qkeymapper_p.cpp"
static QWidgetList topLevelWidgets()
Returns a list of the top-level widgets (windows) in the application.
\inmodule QtCore
Definition qcoreevent.h:45
@ KeyboardLayoutChange
Definition qcoreevent.h:205
static QPlatformIntegration * platformIntegration()
The QKeyEvent class describes a key event.
Definition qevent.h:423
QLocale keyboardInputLocale
QList< int > possibleKeys(QKeyEvent *e)
Qt::LayoutDirection keyboardInputDirection
static QList< int > possibleKeys(QKeyEvent *e)
static void changeKeyboard()
~QKeyMapper()
Destroys the key mapper.
QKeyMapper()
Constructs a new key mapper.
static QKeyMapper * instance()
Returns the pointer to the single instance of QKeyMapper in the application.
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
Qt::LayoutDirection textDirection() const
Definition qlocale.cpp:3204
static QLocale system()
Returns a QLocale object initialized to the system locale.
Definition qlocale.cpp:2742
\inmodule QtCore
Definition qobject.h:90
virtual QList< int > possibleKeys(const QKeyEvent *) const
Should be used to obtain a list of possible shortcuts for the given key event.
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
double e
Combined button and popup list for selecting options.
@ Key_unknown
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
QKeyMapperPrivate * qt_keymapper_private()
static QList< int > extractKeyFromEvent(QKeyEvent *e)
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
GLfloat GLfloat GLfloat w
[0]
GLuint name
struct _cl_event * event
GLuint64EXT * result
[6]
#define Q_UNUSED(x)
QList< int > list
[14]
QObject::connect nullptr