File indexing completed on 2025-09-17 09:09:59
0001
0002
0003
0004 #ifndef QEVENTPOINT_H
0005 #define QEVENTPOINT_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qvector2d.h>
0009 #include <QtGui/qpointingdevice.h>
0010 #include <QtCore/qshareddata.h>
0011 #include <QtCore/qmetatype.h>
0012
0013 QT_BEGIN_NAMESPACE
0014
0015 class QEventPointPrivate;
0016 QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QEventPointPrivate, Q_GUI_EXPORT)
0017 class QMutableEventPoint;
0018
0019 class Q_GUI_EXPORT QEventPoint
0020 {
0021 Q_GADGET
0022 Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
0023 Q_PROPERTY(const QPointingDevice *device READ device CONSTANT)
0024 Q_PROPERTY(int id READ id CONSTANT)
0025 Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId CONSTANT)
0026 Q_PROPERTY(State state READ state CONSTANT)
0027 Q_PROPERTY(ulong timestamp READ timestamp CONSTANT)
0028 Q_PROPERTY(ulong pressTimestamp READ pressTimestamp CONSTANT)
0029 Q_PROPERTY(ulong lastTimestamp READ lastTimestamp CONSTANT)
0030 Q_PROPERTY(qreal timeHeld READ timeHeld CONSTANT)
0031 Q_PROPERTY(qreal pressure READ pressure CONSTANT)
0032 Q_PROPERTY(qreal rotation READ rotation CONSTANT)
0033 Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters CONSTANT)
0034 Q_PROPERTY(QVector2D velocity READ velocity CONSTANT)
0035 Q_PROPERTY(QPointF position READ position CONSTANT)
0036 Q_PROPERTY(QPointF pressPosition READ pressPosition CONSTANT)
0037 Q_PROPERTY(QPointF grabPosition READ grabPosition CONSTANT)
0038 Q_PROPERTY(QPointF lastPosition READ lastPosition CONSTANT)
0039 Q_PROPERTY(QPointF scenePosition READ scenePosition CONSTANT)
0040 Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition CONSTANT)
0041 Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition CONSTANT)
0042 Q_PROPERTY(QPointF sceneLastPosition READ sceneLastPosition CONSTANT)
0043 Q_PROPERTY(QPointF globalPosition READ globalPosition CONSTANT)
0044 Q_PROPERTY(QPointF globalPressPosition READ globalPressPosition CONSTANT)
0045 Q_PROPERTY(QPointF globalGrabPosition READ globalGrabPosition CONSTANT)
0046 Q_PROPERTY(QPointF globalLastPosition READ globalLastPosition CONSTANT)
0047 public:
0048 enum State : quint8 {
0049 Unknown = Qt::TouchPointUnknownState,
0050 Stationary = Qt::TouchPointStationary,
0051 Pressed = Qt::TouchPointPressed,
0052 Updated = Qt::TouchPointMoved,
0053 Released = Qt::TouchPointReleased
0054 };
0055 Q_DECLARE_FLAGS(States, State)
0056 Q_FLAG(States)
0057
0058 explicit QEventPoint(int id = -1, const QPointingDevice *device = nullptr);
0059 QEventPoint(int pointId, State state, const QPointF &scenePosition, const QPointF &globalPosition);
0060 QEventPoint(const QEventPoint &other) noexcept;
0061 QEventPoint &operator=(const QEventPoint &other) noexcept;
0062 QEventPoint(QEventPoint && other) noexcept = default;
0063 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEventPoint)
0064 bool operator==(const QEventPoint &other) const noexcept;
0065 bool operator!=(const QEventPoint &other) const noexcept { return !operator==(other); }
0066 ~QEventPoint();
0067 inline void swap(QEventPoint &other) noexcept
0068 { d.swap(other.d); }
0069
0070 QPointF position() const;
0071 QPointF pressPosition() const;
0072 QPointF grabPosition() const;
0073 QPointF lastPosition() const;
0074 QPointF scenePosition() const;
0075 QPointF scenePressPosition() const;
0076 QPointF sceneGrabPosition() const;
0077 QPointF sceneLastPosition() const;
0078 QPointF globalPosition() const;
0079 QPointF globalPressPosition() const;
0080 QPointF globalGrabPosition() const;
0081 QPointF globalLastPosition() const;
0082 QPointF normalizedPosition() const;
0083
0084 #if QT_DEPRECATED_SINCE(6, 0)
0085
0086 QT_DEPRECATED_VERSION_X_6_0("Use position()")
0087 QPointF pos() const { return position(); }
0088 QT_DEPRECATED_VERSION_X_6_0("Use pressPosition()")
0089 QPointF startPos() const { return pressPosition(); }
0090 QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()")
0091 QPointF scenePos() const { return scenePosition(); }
0092 QT_DEPRECATED_VERSION_X_6_0("Use scenePressPosition()")
0093 QPointF startScenePos() const { return scenePressPosition(); }
0094 QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()")
0095 QPointF screenPos() const { return globalPosition(); }
0096 QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
0097 QPointF startScreenPos() const { return globalPressPosition(); }
0098 QT_DEPRECATED_VERSION_X_6_0("Use globalPressPosition()")
0099 QPointF startNormalizedPos() const;
0100 QT_DEPRECATED_VERSION_X_6_0("Use normalizedPosition()")
0101 QPointF normalizedPos() const { return normalizedPosition(); }
0102 QT_DEPRECATED_VERSION_X_6_0("Use lastPosition()")
0103 QPointF lastPos() const { return lastPosition(); }
0104 QT_DEPRECATED_VERSION_X_6_0("Use sceneLastPosition()")
0105 QPointF lastScenePos() const { return sceneLastPosition(); }
0106 QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
0107 QPointF lastScreenPos() const { return globalLastPosition(); }
0108 QT_DEPRECATED_VERSION_X_6_0("Use globalLastPosition()")
0109 QPointF lastNormalizedPos() const;
0110 #endif
0111 QVector2D velocity() const;
0112 State state() const;
0113 const QPointingDevice *device() const;
0114 int id() const;
0115 QPointingDeviceUniqueId uniqueId() const;
0116 ulong timestamp() const;
0117 ulong lastTimestamp() const;
0118 ulong pressTimestamp() const;
0119 qreal timeHeld() const;
0120 qreal pressure() const;
0121 qreal rotation() const;
0122 QSizeF ellipseDiameters() const;
0123
0124 bool isAccepted() const;
0125 void setAccepted(bool accepted = true);
0126
0127 private:
0128 QExplicitlySharedDataPointer<QEventPointPrivate> d;
0129 friend class QMutableEventPoint;
0130 friend class QPointerEvent;
0131 };
0132
0133 #ifndef QT_NO_DEBUG_STREAM
0134 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint *);
0135 Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint &);
0136 #endif
0137
0138 Q_DECLARE_SHARED(QEventPoint)
0139
0140 QT_END_NAMESPACE
0141
0142 #endif