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
qeventpoint.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 QEVENTPOINT_H
5#define QEVENTPOINT_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtGui/qvector2d.h>
9#include <QtGui/qpointingdevice.h>
10#include <QtCore/qshareddata.h>
11#include <QtCore/qmetatype.h>
12
14
18
19class Q_GUI_EXPORT QEventPoint
20{
22 Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
24 Q_PROPERTY(int id READ id CONSTANT)
25 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
26 Q_PROPERTY(State state READ state CONSTANT)
27 Q_PROPERTY(ulong timestamp READ timestamp CONSTANT)
28 Q_PROPERTY(ulong pressTimestamp READ pressTimestamp CONSTANT)
29 Q_PROPERTY(ulong lastTimestamp READ lastTimestamp CONSTANT)
30 Q_PROPERTY(qreal timeHeld READ timeHeld CONSTANT)
31 Q_PROPERTY(qreal pressure READ pressure CONSTANT)
32 Q_PROPERTY(qreal rotation READ rotation CONSTANT)
33 Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters CONSTANT)
34 Q_PROPERTY(QVector2D velocity READ velocity CONSTANT)
36 Q_PROPERTY(QPointF pressPosition READ pressPosition CONSTANT)
37 Q_PROPERTY(QPointF grabPosition READ grabPosition CONSTANT)
38 Q_PROPERTY(QPointF lastPosition READ lastPosition CONSTANT)
39 Q_PROPERTY(QPointF scenePosition READ scenePosition CONSTANT)
40 Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition CONSTANT)
41 Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition CONSTANT)
42 Q_PROPERTY(QPointF sceneLastPosition READ sceneLastPosition CONSTANT)
43 Q_PROPERTY(QPointF globalPosition READ globalPosition CONSTANT)
44 Q_PROPERTY(QPointF globalPressPosition READ globalPressPosition CONSTANT)
45 Q_PROPERTY(QPointF globalGrabPosition READ globalGrabPosition CONSTANT)
46 Q_PROPERTY(QPointF globalLastPosition READ globalLastPosition CONSTANT)
47public:
57
58 explicit QEventPoint(int id = -1, const QPointingDevice *device = nullptr);
59 QEventPoint(int pointId, State state, const QPointF &scenePosition, const QPointF &globalPosition);
60 QEventPoint(const QEventPoint &other) noexcept;
62 QEventPoint(QEventPoint && other) noexcept = default;
63 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEventPoint)
64 bool operator==(const QEventPoint &other) const noexcept;
65 bool operator!=(const QEventPoint &other) const noexcept { return !operator==(other); }
67 inline void swap(QEventPoint &other) noexcept
68 { d.swap(other.d); }
69
70 QPointF position() const;
71 QPointF pressPosition() const;
72 QPointF grabPosition() const;
73 QPointF lastPosition() const;
74 QPointF scenePosition() const;
75 QPointF scenePressPosition() const;
76 QPointF sceneGrabPosition() const;
77 QPointF sceneLastPosition() const;
78 QPointF globalPosition() const;
79 QPointF globalPressPosition() const;
80 QPointF globalGrabPosition() const;
81 QPointF globalLastPosition() const;
82 QPointF normalizedPosition() const;
83
84#if QT_DEPRECATED_SINCE(6, 0)
85 // QEventPoint replaces QTouchEvent::TouchPoint, so we need all its old accessors, for now
86 QT_DEPRECATED_VERSION_X_6_0("Use position()")
87 QPointF pos() const { return position(); }
88 QT_DEPRECATED_VERSION_X_6_0("Use pressPosition()")
89 QPointF startPos() const { return pressPosition(); }
90 QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
91 QPointF scenePos() const { return scenePosition(); }
92 QT_DEPRECATED_VERSION_X_6_0("Use scenePressPosition()")
93 QPointF startScenePos() const { return scenePressPosition(); }
94 QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
95 QPointF screenPos() const { return globalPosition(); }
96 QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
97 QPointF startScreenPos() const { return globalPressPosition(); }
98 QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
99 QPointF startNormalizedPos() const;
100 QT_DEPRECATED_VERSION_X_6_0("Use normalizedPosition()")
101 QPointF normalizedPos() const { return normalizedPosition(); }
102 QT_DEPRECATED_VERSION_X_6_0("Use lastPosition()")
103 QPointF lastPos() const { return lastPosition(); }
104 QT_DEPRECATED_VERSION_X_6_0("Use sceneLastPosition()")
105 QPointF lastScenePos() const { return sceneLastPosition(); }
106 QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
107 QPointF lastScreenPos() const { return globalLastPosition(); }
108 QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
109 QPointF lastNormalizedPos() const;
110#endif // QT_DEPRECATED_SINCE(6, 0)
111 QVector2D velocity() const;
112 State state() const;
113 const QPointingDevice *device() const;
114 int id() const;
115 QPointingDeviceUniqueId uniqueId() const;
116 ulong timestamp() const;
117 ulong lastTimestamp() const;
118 ulong pressTimestamp() const;
119 qreal timeHeld() const;
120 qreal pressure() const;
121 qreal rotation() const;
122 QSizeF ellipseDiameters() const;
123
124 bool isAccepted() const;
125 void setAccepted(bool accepted = true);
126
127private:
128 QExplicitlySharedDataPointer<QEventPointPrivate> d;
129 friend class QMutableEventPoint;
130 friend class QPointerEvent;
131};
132
133#ifndef QT_NO_DEBUG_STREAM
134Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint *);
135Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint &);
136#endif
137
138Q_DECLARE_SHARED(QEventPoint)
139
141
142#endif // QEVENTPOINT_H
IOBluetoothDevice * device
\inmodule QtCore
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
~QEventPoint()
Destroys the event point.
void swap(QEventPoint &other) noexcept
Definition qeventpoint.h:67
QEventPoint(const QEventPoint &other) noexcept
Constructs an event point by making a shallow copy of other.
QEventPoint & operator=(const QEventPoint &other) noexcept
Assigns other to this event point and returns a reference to this event point.
QEventPoint(QEventPoint &&other) noexcept=default
Constructs an event point by moving other.
bool operator!=(const QEventPoint &other) const noexcept
Returns true if this event point is not equal to other, otherwise return false.
Definition qeventpoint.h:65
\inmodule QtCore\reentrant
Definition qpoint.h:217
A base class for pointer events.
Definition qevent.h:73
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.
\inmodule QtCore
Definition qsize.h:208
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
else opt state
[0]
Combined button and popup list for selecting options.
@ TouchPointReleased
@ TouchPointStationary
@ TouchPointPressed
@ TouchPointMoved
@ TouchPointUnknownState
Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint *)
Definition qevent.cpp:4002
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
GLenum GLuint id
[7]
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(Class, ExportMacro)
#define QT_DEPRECATED_VERSION_X_6_0(text)
#define Q_PROPERTY(...)
#define Q_FLAG(x)
#define Q_GADGET
unsigned long ulong
Definition qtypes.h:35
double qreal
Definition qtypes.h:187
unsigned char quint8
Definition qtypes.h:46
QSharedPointer< T > other(t)
[5]