diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-24 12:58:48 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-27 11:09:17 +0000 |
commit | 926d69a61c50bf970c0f6cc5dddf735e996f502e (patch) | |
tree | dd6ad34ee81844d0b8be7375db9998fcdd69e9e2 /src/quick/handlers | |
parent | b7f9f342480c669780a244c237642edaf5b57bc3 (diff) |
QQPSingleHandler: store m_scenePressPos separately
The scene-relative position at which an EventPoint was pressed does
not change during a drag. The target item is moving, so we cannot
convert a point relative to the target item back to a scene position
and expect it to stay constant.
Change-Id: I07389993c6b15316b686824c37dbad83b4b10861
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r-- | src/quick/handlers/qquickpointersinglehandler.cpp | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickpointersinglehandler_p.h | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickpointersinglehandler.cpp b/src/quick/handlers/qquickpointersinglehandler.cpp index 5ad60291dd..dca98f6a50 100644 --- a/src/quick/handlers/qquickpointersinglehandler.cpp +++ b/src/quick/handlers/qquickpointersinglehandler.cpp @@ -145,6 +145,7 @@ void QQuickPointerSingleHandler::handlePointerEventImpl(QQuickPointerEvent *even switch (currentPoint->state()) { case QQuickEventPoint::Pressed: m_pressPos = currentPoint->pos(); + m_scenePressPos = currentPoint->scenePos(); setPressedButtons(event->buttons()); emit pointIdChanged(); break; @@ -223,6 +224,7 @@ void QQuickPointerSingleHandler::reset() m_uniquePointId = QPointingDeviceUniqueId(); m_pos = QPointF(); m_pressPos = QPointF(); + m_scenePressPos = QPointF(); m_sceneGrabPos = QPointF(); m_velocity = QVector2D(); m_rotation = 0; diff --git a/src/quick/handlers/qquickpointersinglehandler_p.h b/src/quick/handlers/qquickpointersinglehandler_p.h index 466de1a1eb..70aa26801f 100644 --- a/src/quick/handlers/qquickpointersinglehandler_p.h +++ b/src/quick/handlers/qquickpointersinglehandler_p.h @@ -80,7 +80,7 @@ public: Qt::MouseButtons acceptedButtons() const { return m_acceptedButtons; } void setAcceptedButtons(Qt::MouseButtons buttons); QPointF pressPos() const { return m_pressPos; } - QPointF scenePressPos() const { return parentItem()->mapToScene(m_pressPos); } + QPointF scenePressPos() const { return m_scenePressPos; } QPointF sceneGrabPos() const { return m_sceneGrabPos; } QPointF pos() const { return m_pos; } QPointF scenePos() const { return parentItem()->mapToScene(m_pos); } @@ -118,6 +118,7 @@ private: Qt::MouseButtons m_pressedButtons; QPointF m_pos; QPointF m_pressPos; + QPointF m_scenePressPos; QPointF m_sceneGrabPos; QVector2D m_velocity; qreal m_rotation; |