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