From 5094493d28dc3e4618eb02d1cbe949627e02556c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 2 Jul 2012 15:23:24 +0200 Subject: [PATCH] Fix transformed flickable so that the new autotest can pass Not sure why we switched to using window coordinates in the last patch, but that's the reason the new test fails. Change-Id: Icb3b221fc3babb2e628af74066771e9eae8ff5ff Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickflickable.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 750f7d9..fadf59e 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -971,7 +971,7 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) vData.dragMaxBound = q->maxYExtent(); fixupMode = Normal; lastPos = QPointF(); - pressPos = event->windowPos(); + pressPos = event->localPos(); hData.pressPos = hData.move.value(); vData.pressPos = vData.move.value(); bool wasFlicking = hData.flicking || vData.flicking; @@ -1006,7 +1006,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) qint64 elapsedSincePress = computeCurrentTime(event) - lastPressTime; if (q->yflick()) { - qreal dy = event->windowPos().y() - pressPos.y(); + qreal dy = event->localPos().y() - pressPos.y(); bool overThreshold = QQuickCanvasPrivate::dragOverThreshold(dy, Qt::YAxis, event); if (overThreshold || elapsedSincePress > 200) { if (!vMoved) @@ -1040,7 +1040,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) } if (q->xflick()) { - qreal dx = event->windowPos().x() - pressPos.x(); + qreal dx = event->localPos().x() - pressPos.x(); bool overThreshold = QQuickCanvasPrivate::dragOverThreshold(dx, Qt::XAxis, event); if (overThreshold || elapsedSincePress > 200) { if (!hMoved) @@ -1101,7 +1101,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) { vData.addVelocitySample(QGuiApplicationPrivate::mouseEventVelocity(event).y(), maxVelocity); } else { - qreal dy = event->windowPos().y() - (lastPos.isNull() ? pressPos.y() : lastPos.y()); + qreal dy = event->localPos().y() - (lastPos.isNull() ? pressPos.y() : lastPos.y()); vData.addVelocitySample(dy/elapsed, maxVelocity); } } @@ -1109,12 +1109,12 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) { hData.addVelocitySample(QGuiApplicationPrivate::mouseEventVelocity(event).x(), maxVelocity); } else { - qreal dx = event->windowPos().x() - (lastPos.isNull() ? pressPos.x() : lastPos.x()); + qreal dx = event->localPos().x() - (lastPos.isNull() ? pressPos.x() : lastPos.x()); hData.addVelocitySample(dx/elapsed, maxVelocity); } } - lastPos = event->windowPos(); + lastPos = event->localPos(); } void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) @@ -1173,7 +1173,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) bool flickedV = false; vVelocity *= flickBoost; - if (q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->windowPos().y() - pressPos.y()) > FlickThreshold) { + if (q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->localPos().y() - pressPos.y()) > FlickThreshold) { velocityTimeline.reset(vData.smoothVelocity); vData.smoothVelocity.setValue(-vVelocity); flickedV = flickY(vVelocity); @@ -1183,7 +1183,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) bool flickedH = false; hVelocity *= flickBoost; - if (q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->windowPos().x() - pressPos.x()) > FlickThreshold) { + if (q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->localPos().x() - pressPos.x()) > FlickThreshold) { velocityTimeline.reset(hData.smoothVelocity); hData.smoothVelocity.setValue(-hVelocity); flickedH = flickX(hVelocity); -- 1.7.2.5