Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qinputdevice.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QINPUTDEVICE_H
6#define QINPUTDEVICE_H
7
8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qobject.h>
10#include <QtGui/qscreen.h>
11
12QT_BEGIN_NAMESPACE
13
14class QDebug;
15class QInputDevicePrivate;
16
17class Q_GUI_EXPORT QInputDevice : public QObject
18{
19 Q_OBJECT
20 Q_DECLARE_PRIVATE(QInputDevice)
21 Q_PROPERTY(QString name READ name CONSTANT)
22 Q_PROPERTY(DeviceType type READ type CONSTANT)
23 Q_PROPERTY(Capabilities capabilities READ capabilities
24 NOTIFY capabilitiesChanged)
25 Q_PROPERTY(qint64 systemId READ systemId CONSTANT)
26 Q_PROPERTY(QString seatName READ seatName CONSTANT)
27 Q_PROPERTY(QRect availableVirtualGeometry READ availableVirtualGeometry
28 NOTIFY availableVirtualGeometryChanged)
30public:
31 enum class DeviceType {
32 Unknown = 0x0000,
33 Mouse = 0x0001,
34 TouchScreen = 0x0002,
35 TouchPad = 0x0004,
36 Puck = 0x0008,
37 Stylus = 0x0010,
38 Airbrush = 0x0020,
39 Keyboard = 0x1000,
40 AllDevices = 0x7FFFFFFF
41 };
42 Q_DECLARE_FLAGS(DeviceTypes, DeviceType)
43 Q_FLAG(DeviceTypes)
45 enum class Capability {
46 None = 0,
47 Position = 0x0001,
48 Area = 0x0002,
49 Pressure = 0x0004,
50 Velocity = 0x0008,
51 NormalizedPosition = 0x0020,
52 MouseEmulation = 0x0040,
53 PixelScroll = 0x0080,
54 Scroll = 0x0100,
55 Hover = 0x0200,
56 Rotation = 0x0400,
57 XTilt = 0x0800,
58 YTilt = 0x1000,
59 TangentialPressure = 0x2000,
60 ZPosition = 0x4000,
61 All = 0x7FFFFFFF
62 };
63 Q_DECLARE_FLAGS(Capabilities, Capability)
64 Q_FLAG(Capabilities)
65
66 QInputDevice(QObject *parent = nullptr);
67 ~QInputDevice();
68 QInputDevice(const QString &name, qint64 systemId, DeviceType type,
69 const QString &seatName = QString(), QObject *parent = nullptr);
70
71 QString name() const;
72 DeviceType type() const;
73 Capabilities capabilities() const;
74 bool hasCapability(Capability cap) const;
75 qint64 systemId() const;
76 QString seatName() const;
77 QRect availableVirtualGeometry() const;
78
79 static QStringList seatNames();
80 static QList<const QInputDevice *> devices();
81 static const QInputDevice *primaryKeyboard(const QString& seatName = QString());
82
83 bool operator==(const QInputDevice &other) const;
85Q_SIGNALS:
86 void availableVirtualGeometryChanged(QRect area);
87 Q_REVISION(6, 9) void capabilitiesChanged(Capabilities capabilities);
88
89protected:
90 QInputDevice(QInputDevicePrivate &d, QObject *parent);
91
92 Q_DISABLE_COPY_MOVE(QInputDevice)
93};
94
95Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::DeviceTypes)
96Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDevice::Capabilities)
97
98#ifndef QT_NO_DEBUG_STREAM
99Q_GUI_EXPORT QDebug operator<<(QDebug, const QInputDevice *);
100#endif
101
102QT_END_NAMESPACE
103
104#endif // QINPUTDEVICE_H
The QInputDevice class describes a device from which a QInputEvent originates.
Combined button and popup list for selecting options.