diff options
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativeflickable.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 2e5a43d..b737785 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -483,9 +483,9 @@ qreal QDeclarativeFlickable::contentX() const void QDeclarativeFlickable::setContentX(qreal pos) { Q_D(QDeclarativeFlickable); - pos = qRound(pos); d->timeline.reset(d->hData.move); d->vTime = d->timeline.time(); + movementXEnding(); if (-pos != d->hData.move.value()) { d->hData.move.setValue(-pos); viewportMoved(); @@ -501,9 +501,9 @@ qreal QDeclarativeFlickable::contentY() const void QDeclarativeFlickable::setContentY(qreal pos) { Q_D(QDeclarativeFlickable); - pos = qRound(pos); d->timeline.reset(d->vData.move); d->vTime = d->timeline.time(); + movementYEnding(); if (-pos != d->vData.move.value()) { d->vData.move.setValue(-pos); viewportMoved(); @@ -1516,6 +1516,15 @@ void QDeclarativeFlickable::movementStarting() void QDeclarativeFlickable::movementEnding() { Q_D(QDeclarativeFlickable); + movementXEnding(); + movementYEnding(); + d->hData.smoothVelocity.setValue(0); + d->vData.smoothVelocity.setValue(0); +} + +void QDeclarativeFlickable::movementXEnding() +{ + Q_D(QDeclarativeFlickable); if (d->flickingHorizontally) { d->flickingHorizontally = false; emit flickingChanged(); @@ -1523,13 +1532,6 @@ void QDeclarativeFlickable::movementEnding() if (!d->flickingVertically) emit flickEnded(); } - if (d->flickingVertically) { - d->flickingVertically = false; - emit flickingChanged(); - emit flickingVerticallyChanged(); - if (!d->flickingHorizontally) - emit flickEnded(); - } if (!d->pressed && !d->stealMouse) { if (d->movingHorizontally) { d->movingHorizontally = false; @@ -1539,6 +1541,20 @@ void QDeclarativeFlickable::movementEnding() if (!d->movingVertically) emit movementEnded(); } + } +} + +void QDeclarativeFlickable::movementYEnding() +{ + Q_D(QDeclarativeFlickable); + if (d->flickingVertically) { + d->flickingVertically = false; + emit flickingChanged(); + emit flickingVerticallyChanged(); + if (!d->flickingHorizontally) + emit flickEnded(); + } + if (!d->pressed && !d->stealMouse) { if (d->movingVertically) { d->movingVertically = false; d->vMoved = false; @@ -1548,8 +1564,6 @@ void QDeclarativeFlickable::movementEnding() emit movementEnded(); } } - d->hData.smoothVelocity.setValue(0); - d->vData.smoothVelocity.setValue(0); } void QDeclarativeFlickablePrivate::updateVelocity() |