aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickhandlerpoint_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-06-19 12:44:59 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-09-04 13:48:54 +0200
commita1c91787264f6f535b5cf094b57ee53058856df4 (patch)
tree80eda1a64f15df34dc49f7bba6f3f31bbe8b6b4d /src/quick/handlers/qquickhandlerpoint_p.h
parent5d9b0d30df831649ceed58fee778bb37ac6f630e (diff)
Add QQuickHandlerPoint::device property
The HandlerPoint type is used as the memory of an event or TouchPoint that a handler has already handled. Maybe in the future we'll store a copy of a QEventPoint instead. But for now, it's nice to have the device pointer available for binding properties, instead of only in QQuickEventPoint, which was only exposed in signals like TapHandler.tapped(). Change-Id: I314fc8c76311dc2620f1d97d4cadacf2e9869274 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickhandlerpoint_p.h')
-rw-r--r--src/quick/handlers/qquickhandlerpoint_p.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickhandlerpoint_p.h b/src/quick/handlers/qquickhandlerpoint_p.h
index 44fd830af2..6ba5e3bf28 100644
--- a/src/quick/handlers/qquickhandlerpoint_p.h
+++ b/src/quick/handlers/qquickhandlerpoint_p.h
@@ -73,6 +73,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint {
Q_PROPERTY(qreal rotation READ rotation)
Q_PROPERTY(qreal pressure READ pressure)
Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters)
+ Q_PROPERTY(QPointingDevice *device READ device)
public:
QQuickHandlerPoint();
@@ -90,6 +91,8 @@ public:
qreal pressure() const { return m_pressure; }
QSizeF ellipseDiameters() const { return m_ellipseDiameters; }
QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; }
+ // non-const only because of QML engine limitations (similar to QTBUG-61749)
+ QPointingDevice *device() const { return const_cast<QPointingDevice *>(m_device); }
void localize(QQuickItem *item);
void reset();
@@ -98,6 +101,7 @@ public:
private:
int m_id = 0;
+ const QPointingDevice *m_device = QPointingDevice::primaryPointingDevice();
QPointingDeviceUniqueId m_uniqueId;
Qt::MouseButtons m_pressedButtons = Qt::NoButton;
Qt::KeyboardModifiers m_pressedModifiers = Qt::NoModifier;