diff options
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable.cpp | 34 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeflickable_p.h | 2 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 2e5a43d..57ce4ce 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -486,6 +486,7 @@ void QDeclarativeFlickable::setContentX(qreal pos) 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(); @@ -504,6 +505,7 @@ void QDeclarativeFlickable::setContentY(qreal pos) 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 +1518,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 +1534,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 +1543,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 +1566,6 @@ void QDeclarativeFlickable::movementEnding() emit movementEnded(); } } - d->hData.smoothVelocity.setValue(0); - d->vData.smoothVelocity.setValue(0); } void QDeclarativeFlickablePrivate::updateVelocity() diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 4fb9c25..6e4d8ed 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -190,6 +190,8 @@ protected Q_SLOTS: void movementEnding(); protected: + void movementXEnding(); + void movementYEnding(); virtual qreal minXExtent() const; virtual qreal minYExtent() const; virtual qreal maxXExtent() const; |