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