Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpointingdevice.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 QPOINTINGDEVICE_H
5#define QPOINTINGDEVICE_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qobject.h>
9#include <QtGui/qinputdevice.h>
10
12
13class QDebug;
14class QEventPoint;
15class QPointerEvent;
17class QPointerEvent;
18class QScreen;
19
20class Q_GUI_EXPORT QPointingDeviceUniqueId
21{
23 Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
24public:
26 constexpr QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
27 // compiler-generated copy/move ctor/assignment operators are ok!
28 // compiler-generated dtor is ok!
29
30 static QPointingDeviceUniqueId fromNumericId(qint64 id);
31
32 Q_ALWAYS_INLINE constexpr bool isValid() const noexcept { return m_numericId != -1; }
33 qint64 numericId() const noexcept;
34
36 friend bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
37 { return lhs.numericId() == rhs.numericId(); }
39 { return lhs.numericId() != rhs.numericId(); }
40
41 // TODO: for TUIO 2, or any other type of complex token ID, an internal
42 // array (or hash) can be added to hold additional properties.
43 // In this case, m_numericId will then turn into an index into that array (or hash).
44 qint64 m_numericId;
45};
47
48Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;
49
50class Q_GUI_EXPORT QPointingDevice : public QInputDevice
51{
53 Q_DECLARE_PRIVATE(QPointingDevice)
55 Q_PROPERTY(int maximumPoints READ maximumPoints CONSTANT)
56 Q_PROPERTY(int buttonCount READ buttonCount CONSTANT)
57 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
58
59public:
60 enum class PointerType {
61 Unknown = 0,
62 Generic = 0x0001, // mouse or similar
63 Finger = 0x0002, // touchscreen or pad
64 Pen = 0x0004, // stylus on a tablet
65 Eraser = 0x0008, // eraser end of a stylus
66 Cursor = 0x0010, // digitizer with crosshairs
67 AllPointerTypes = 0x7FFF
68 };
69 Q_DECLARE_FLAGS(PointerTypes, PointerType)
70 Q_FLAG(PointerTypes)
71
73 GrabPassive = 0x01,
74 UngrabPassive = 0x02,
75 CancelGrabPassive = 0x03,
76 OverrideGrabPassive = 0x04,
77 GrabExclusive = 0x10,
78 UngrabExclusive = 0x20,
79 CancelGrabExclusive = 0x30,
80 };
81 Q_ENUM(GrabTransition)
82
83 QPointingDevice(QObject *parent = nullptr);
86 PointerType pType, Capabilities caps, int maxPoints, int buttonCount,
87 const QString &seatName = QString(),
89 QObject *parent = nullptr);
90
91#if QT_DEPRECATED_SINCE(6, 0)
92 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
93 void setType(DeviceType devType);
94 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
95 void setCapabilities(QInputDevice::Capabilities caps);
96 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
97 void setMaximumTouchPoints(int c);
98#endif
99
100 PointerType pointerType() const;
101 int maximumPoints() const;
102 int buttonCount() const;
103 QPointingDeviceUniqueId uniqueId() const;
104
105 static const QPointingDevice *primaryPointingDevice(const QString& seatName = QString());
106
107 bool operator==(const QPointingDevice &other) const;
108
110#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
111 void grabChanged(QObject *grabber, GrabTransition transition,
112 const QPointerEvent *event, const QEventPoint &point) const;
113#else
115 const QPointerEvent *event, const QEventPoint &point);
116#endif
117
118protected:
120
121 Q_DISABLE_COPY_MOVE(QPointingDevice)
122};
123
124Q_DECLARE_OPERATORS_FOR_FLAGS(QPointingDevice::PointerTypes)
125
126#ifndef QT_NO_DEBUG_STREAM
127Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *);
128#endif
129
130//typedef QPointingDevice QTouchDevice; // Qt 5 source compatibility if we need it? or could be "using"
131
133
134#endif // QPOINTINGDEVICE_H
\inmodule QtCore
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
The QInputDevice class describes a device from which a QInputEvent originates.
DeviceType
This enum represents the type of device that generated a QPointerEvent.
\inmodule QtCore
Definition qobject.h:103
A base class for pointer events.
Definition qevent.h:73
QPointingDeviceUniqueId identifies a unique object, such as a tagged token or stylus,...
friend bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
Q_ALWAYS_INLINE constexpr bool isValid() const noexcept
Returns whether this unique pointer ID is valid, that is, it represents an actual pointer.
Q_ALWAYS_INLINE constexpr QPointingDeviceUniqueId() noexcept
Constructs an invalid unique pointer ID.
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
GrabTransition
This enum represents a transition of exclusive or passive grab from one object (possibly nullptr) to ...
PointerType
This enum represents what is interacting with the pointing device.
void grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition, const QPointerEvent *event, const QEventPoint &point)
This signal is emitted when the grabber object gains or loses an exclusive or passive grab of point d...
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
#define Q_ALWAYS_INLINE
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLuint64 key
GLuint name
struct _cl_event * event
const GLubyte * c
Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed=0) noexcept
Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_DEPRECATED_VERSION_X_6_0(text)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_GADGET
#define Q_SIGNALS
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
long long qint64
Definition qtypes.h:60
PointerType
Definition qwasmevent.h:40
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
QSharedPointer< T > other(t)
[5]
proxy setType(QNetworkProxy::Socks5Proxy)