diff options
5 files changed, 25 insertions, 16 deletions
diff --git a/.qmake.conf b/.qmake.conf index 5de255cb..4baafa83 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,2 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs + +MODULE_VERSION = 5.2.0 diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index c0c7b2a0..64ae2094 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -789,9 +789,9 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); - if (vData.dragStartOffset == 0) - vData.dragStartOffset = dy; if (qAbs(dy) > QApplication::startDragDistance() || QDeclarativeItemPrivate::elapsed(pressTime) > 200) { + if (!vMoved) + vData.dragStartOffset = dy; qreal newY = dy + vData.pressPos - vData.dragStartOffset; const qreal minY = vData.dragMinBound; const qreal maxY = vData.dragMaxBound; @@ -818,9 +818,9 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent if (q->xflick()) { int dx = int(event->pos().x() - pressPos.x()); - if (hData.dragStartOffset == 0) - hData.dragStartOffset = dx; if (qAbs(dx) > QApplication::startDragDistance() || QDeclarativeItemPrivate::elapsed(pressTime) > 200) { + if (!hMoved) + hData.dragStartOffset = dx; qreal newX = dx + hData.pressPos - hData.dragStartOffset; const qreal minX = hData.dragMinBound; const qreal maxX = hData.dragMaxBound; diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 9fa325b0..4752ec32 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -558,6 +558,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (qAbs(x - d->startX) > dragThreshold || qAbs(y - d->startY) > dragThreshold) { setKeepMouseGrab(true); d->stealMouse = true; + d->startScene = event->scenePos(); } } diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index b0fa7bd6..c8a98d33 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -576,6 +576,9 @@ void tst_qdeclarativeflickable::nestedStopAtBounds() axis += invert ? threshold : -threshold; moveEvent.setScenePos(position); QApplication::sendEvent(view.scene(), &moveEvent); + axis += invert ? threshold : -threshold; + moveEvent.setScenePos(position); + QApplication::sendEvent(view.scene(), &moveEvent); QVERIFY(outer->contentX() != 50 || outer->contentY() != 50); QVERIFY((inner->contentX() == 0 || inner->contentX() == 100) && (inner->contentY() == 0 || inner->contentY() == 100)); @@ -594,6 +597,9 @@ void tst_qdeclarativeflickable::nestedStopAtBounds() axis += invert ? -threshold : threshold; moveEvent.setScenePos(position); QApplication::sendEvent(view.scene(), &moveEvent); + axis += invert ? -threshold : threshold; + moveEvent.setScenePos(position); + QApplication::sendEvent(view.scene(), &moveEvent); QVERIFY(outer->contentX() == 50 && outer->contentY() == 50); QVERIFY((inner->contentX() != 0 && inner->contentX() != 100) || (inner->contentY() != 0 && inner->contentY() != 100)); diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index 37e64d4d..0415c5c9 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -239,18 +239,18 @@ void tst_QDeclarativeMouseArea::dragging() QApplication::sendEvent(scene, &moveEvent); QVERIFY(drag->active()); - QCOMPARE(blackRect->x(), 72.0); - QCOMPARE(blackRect->y(), 72.0); + QCOMPARE(blackRect->x(), 61.0); + QCOMPARE(blackRect->y(), 61.0); QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); - releaseEvent.setScenePos(QPointF(110, 110)); + releaseEvent.setScenePos(QPointF(122, 122)); releaseEvent.setButton(Qt::LeftButton); releaseEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &releaseEvent); QVERIFY(!drag->active()); - QCOMPARE(blackRect->x(), 72.0); - QCOMPARE(blackRect->y(), 72.0); + QCOMPARE(blackRect->x(), 61.0); + QCOMPARE(blackRect->y(), 61.0); delete canvas; } @@ -597,8 +597,8 @@ void tst_QDeclarativeMouseArea::preventStealing() QVERIFY(!mouseArea->pressed()); // Flickable content should have moved. - QCOMPARE(flickable->contentX(), 30.); - QCOMPARE(flickable->contentY(), 30.); + QCOMPARE(flickable->contentX(), 15.); + QCOMPARE(flickable->contentY(), 15.); QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(50, 50))); @@ -741,14 +741,14 @@ void tst_QDeclarativeMouseArea::changeAxis() QApplication::sendEvent(scene, &moveEvent); QVERIFY(drag->active()); - QCOMPARE(blackRect->x(), 72.0); - QCOMPARE(blackRect->y(), 72.0); + QCOMPARE(blackRect->x(), 61.0); + QCOMPARE(blackRect->y(), 61.0); QCOMPARE(drag->axis(), QDeclarativeDrag::XandYAxis); /* When blackRect.x becomes bigger than 75, the drag axis is change to * Drag.YAxis by the QML code. Verify that this happens, and that the drag * movement is effectively constrained to the Y axis. */ - moveEvent.setScenePos(QPointF(133, 133)); + moveEvent.setScenePos(QPointF(144, 144)); moveEvent.setButton(Qt::LeftButton); moveEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &moveEvent); @@ -757,7 +757,7 @@ void tst_QDeclarativeMouseArea::changeAxis() QCOMPARE(blackRect->y(), 83.0); QCOMPARE(drag->axis(), QDeclarativeDrag::YAxis); - moveEvent.setScenePos(QPointF(144, 144)); + moveEvent.setScenePos(QPointF(155, 155)); moveEvent.setButton(Qt::LeftButton); moveEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &moveEvent); @@ -766,7 +766,7 @@ void tst_QDeclarativeMouseArea::changeAxis() QCOMPARE(blackRect->y(), 94.0); QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); - releaseEvent.setScenePos(QPointF(144, 144)); + releaseEvent.setScenePos(QPointF(155, 155)); releaseEvent.setButton(Qt::LeftButton); releaseEvent.setButtons(Qt::LeftButton); QApplication::sendEvent(scene, &releaseEvent); |