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
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// Qt-Security score:significant reason:default
4
5#ifndef QPOINTINGDEVICE_H
6#define QPOINTINGDEVICE_H
7
8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qobject.h>
10#include <QtGui/qinputdevice.h>
11
13
14class QDebug;
15class QEventPoint;
16class QPointerEvent;
17class QPointingDevicePrivate;
18class QPointerEvent;
19class QScreen;
20
21class Q_GUI_EXPORT QPointingDeviceUniqueId
22{
23 Q_GADGET
24 Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
25public:
26 Q_ALWAYS_INLINE
27 constexpr QPointingDeviceUniqueId() noexcept : m_numericId(-1) {}
28 // compiler-generated copy/move ctor/assignment operators are ok!
29 // compiler-generated dtor is ok!
30
31 static QPointingDeviceUniqueId fromNumericId(qint64 id);
32
33 Q_ALWAYS_INLINE constexpr bool isValid() const noexcept { return m_numericId != -1; }
34 qint64 numericId() const noexcept;
35
36private:
37 friend bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
38 { return lhs.numericId() == rhs.numericId(); }
39 friend bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept
40 { return lhs.numericId() != rhs.numericId(); }
41
42 // TODO: for TUIO 2, or any other type of complex token ID, an internal
43 // array (or hash) can be added to hold additional properties.
44 // In this case, m_numericId will then turn into an index into that array (or hash).
45 qint64 m_numericId;
46};
47Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_RELOCATABLE_TYPE);
48
49Q_GUI_EXPORT size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0) noexcept;
50
51class Q_GUI_EXPORT QPointingDevice : public QInputDevice
52{
53 Q_OBJECT
54 Q_DECLARE_PRIVATE(QPointingDevice)
55 Q_PROPERTY(PointerType pointerType READ pointerType CONSTANT)
56 Q_PROPERTY(int maximumPoints READ maximumPoints CONSTANT)
57 Q_PROPERTY(int buttonCount READ buttonCount CONSTANT)
58 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
59
60public:
61 enum class PointerType {
62 Unknown = 0,
63 Generic = 0x0001, // mouse or similar
64 Finger = 0x0002, // touchscreen or pad
65 Pen = 0x0004, // stylus on a tablet
66 Eraser = 0x0008, // eraser end of a stylus
67 Cursor = 0x0010, // digitizer with crosshairs
68 Palm = 0x0020, // palm
69 AllPointerTypes = 0x7FFF
70 };
71 Q_DECLARE_FLAGS(PointerTypes, PointerType)
72 Q_FLAG(PointerTypes)
73
74 enum GrabTransition {
75 GrabPassive = 0x01,
76 UngrabPassive = 0x02,
77 CancelGrabPassive = 0x03,
78 OverrideGrabPassive = 0x04,
79 GrabExclusive = 0x10,
80 UngrabExclusive = 0x20,
81 CancelGrabExclusive = 0x30,
82 };
83 Q_ENUM(GrabTransition)
84
85 QPointingDevice(QObject *parent = nullptr);
86 ~QPointingDevice();
87 QPointingDevice(const QString &name, qint64 systemId, QInputDevice::DeviceType devType,
88 PointerType pType, Capabilities caps, int maxPoints, int buttonCount,
89 const QString &seatName = QString(),
90 QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(),
91 QObject *parent = nullptr);
92
93#if QT_DEPRECATED_SINCE(6, 0)
94 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
95 void setType(DeviceType devType);
96 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
97 void setCapabilities(QInputDevice::Capabilities caps);
98 QT_DEPRECATED_VERSION_X_6_0("Use the constructor")
99 void setMaximumTouchPoints(int c);
100#endif
101
102 PointerType pointerType() const;
103 int maximumPoints() const;
104 int buttonCount() const;
105 QPointingDeviceUniqueId uniqueId() const;
106
107 static const QPointingDevice *primaryPointingDevice(const QString& seatName = QString());
108
109 bool operator==(const QPointingDevice &other) const;
110
111Q_SIGNALS:
112#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
113 void grabChanged(QObject *grabber, GrabTransition transition,
114 const QPointerEvent *event, const QEventPoint &point) const;
115#else
116 void grabChanged(QObject *grabber, QPointingDevice::GrabTransition transition,
117 const QPointerEvent *event, const QEventPoint &point);
118#endif
119
120protected:
121 QPointingDevice(QPointingDevicePrivate &d, QObject *parent);
122
123 Q_DISABLE_COPY_MOVE(QPointingDevice)
124};
125
126Q_DECLARE_OPERATORS_FOR_FLAGS(QPointingDevice::PointerTypes)
127
128#ifndef QT_NO_DEBUG_STREAM
129Q_GUI_EXPORT QDebug operator<<(QDebug, const QPointingDevice *);
130#endif
131
132//typedef QPointingDevice QTouchDevice; // Qt 5 source compatibility if we need it? or could be "using"
133
134QT_END_NAMESPACE
135
136#endif // QPOINTINGDEVICE_H
The QClipboard class provides access to the window system clipboard.
Definition qclipboard.h:21
\inmodule QtCore\reentrant
Definition qdatastream.h:50
\reentrant
Definition qfont.h:23
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
QInputDeviceManager acts as a communication hub between QtGui and the input handlers.
The QPalette class contains color groups for each widget state.
Definition qpalette.h:20
The QPlatformIntegration class is the entry for WindowSystem specific functionality.
The QPlatformTheme class allows customizing the UI based on themes.
QPointingDeviceUniqueId identifies a unique object, such as a tagged token or stylus,...
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:177
The QStyleHints class contains platform specific hints and settings. \inmodule QtGui.
Definition qstylehints.h:18
\inmodule QtGui
Definition qwindow.h:64
Combined button and popup list for selecting options.
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
#define qApp
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2582
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
static bool needsWindowBlockedEvent(const QWindow *w)
Q_CORE_EXPORT void qt_call_post_routines()
static void init_plugins(const QList< QByteArray > &pluginList)
static void initFontUnlocked()
static void clearFontUnlocked()
void qRegisterGuiVariant()
static Q_CONSTINIT unsigned applicationResourceFlags
static Q_CONSTINIT int touchDoubleTapDistance
static QWindowGeometrySpecification windowGeometrySpecification
static bool qt_detectRTLLanguage()
Q_CONSTINIT Q_GUI_EXPORT bool qt_is_tty_app
static Q_CONSTINIT bool force_reverse
static Q_CONSTINIT int mouseDoubleClickDistance
#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
static void initThemeHints()
static int nextGeometryToken(const QByteArray &a, int &pos, char *op)
#define CHECK_QAPP_INSTANCE(...)
ApplicationResourceFlags
@ ApplicationFontExplicitlySet
static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
#define qGuiApp
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
void applyTo(QWindow *window) const
static QWindowGeometrySpecification fromArgument(const QByteArray &a)