From: Martin Jones Date: Mon, 14 May 2012 02:49:52 +0000 (+1000) Subject: PathView was moving view too soon on drag X-Git-Tag: upstream/5.2.1~1887 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9575a325c2abce55c7fb2c33c916252790f00352;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 5f912f9..1bc3a3a 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 fbe96bf..057eb2c 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);