diff options
author | Martin Jones <martin.jones@nokia.com> | 2012-05-14 12:49:52 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-14 05:37:29 +0200 |
commit | 9575a325c2abce55c7fb2c33c916252790f00352 (patch) | |
tree | d3a5cf9eaa61c3ddbf371660da8e9b4d5932c5a7 | |
parent | f2502e261155685ac7a4a2ec085c4524e23db278 (diff) |
PathView was moving view too soon on drag
In order to allow gesture grabbing to work correctly, the view shouldn't
react to a drag until the event after the one that triggered it.
Change-Id: I3b84e501aa0f82da821498fa26abe8bbf66a6252
Reviewed-by: Bea Lam <bea.lam@nokia.com>
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 5f912f98f4..1bc3a3a9ab 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1345,6 +1345,7 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event) if (!interactive || !timer.isValid() || !model || !modelCount) return; + qint64 currentTimestamp = computeCurrentTime(event); qreal newPc; QPointF pathPoint = pointNear(event->localPos(), &newPc); if (!stealMouse) { @@ -1352,10 +1353,7 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event) if (qAbs(delta.x()) > qApp->styleHints()->startDragDistance() || qAbs(delta.y()) > qApp->styleHints()->startDragDistance()) { stealMouse = true; } - } - - qint64 currentTimestamp = computeCurrentTime(event); - if (stealMouse) { + } else { moveReason = QQuickPathViewPrivate::Mouse; qreal diff = (newPc - startPc)*modelCount*mappedRange; if (diff) { diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index fbe96bf672..057eb2cb64 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -1231,10 +1231,15 @@ void tst_QQuickPathView::mouseDrag() QMouseEvent mv(QEvent::MouseMove, QPoint(30,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(canvas, &mv); } + // first move beyond threshold does not trigger drag + QVERIFY(!pathview->isMoving()); + { QMouseEvent mv(QEvent::MouseMove, QPoint(90,100), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(canvas, &mv); } + // next move beyond threshold does trigger drag + QVERIFY(pathview->isMoving()); QVERIFY(pathview->currentIndex() != current); |