diff options
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 19fb66c19c..ea4398bc71 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -619,7 +619,7 @@ is finished. \qmlsignal QtQuick::Flickable::movementStarted() This signal is emitted when the view begins moving due to user - interaction. + interaction or a generated flick(). The corresponding handler is \c onMovementStarted. */ @@ -628,9 +628,9 @@ is finished. \qmlsignal QtQuick::Flickable::movementEnded() This signal is emitted when the view stops moving due to user - interaction. If a flick was generated, this signal will + interaction or a generated flick(). If a flick was active, this signal will be emitted once the flick stops. If a flick was not - generated, this signal will be emitted when the + active, this signal will be emitted when the user stops dragging - i.e. a mouse or touch release. The corresponding handler is \c onMovementEnded. @@ -1347,7 +1347,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event) if (window() && window()->mouseGrabberItem()) { QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->windowPos()); QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); - window()->sendEvent(window()->mouseGrabberItem(), mouseEvent.data()); + QCoreApplication::sendEvent(window(), mouseEvent.data()); } // And the event has been consumed @@ -1451,6 +1451,7 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event) d->lastPosTime = currentTimestamp; d->accumulatedWheelPixelDelta += QVector2D(event->pixelDelta()); d->drag(currentTimestamp, event->type(), event->posF(), d->accumulatedWheelPixelDelta, true, !d->scrollingPhase, true, velocity); + event->accept(); } if (!event->isAccepted()) @@ -1670,6 +1671,9 @@ void QQuickFlickable::geometryChanged(const QRectF &newGeometry, \qmlmethod QtQuick::Flickable::flick(qreal xVelocity, qreal yVelocity) Flicks the content with \a xVelocity horizontally and \a yVelocity vertically in pixels/sec. + + Calling this method will update the corresponding moving and flicking properties and signals, + just like a real flick. */ void QQuickFlickable::flick(qreal xVelocity, qreal yVelocity) @@ -1679,8 +1683,15 @@ void QQuickFlickable::flick(qreal xVelocity, qreal yVelocity) d->vData.reset(); d->hData.velocity = xVelocity; d->vData.velocity = yVelocity; + bool flickedX = d->flickX(xVelocity); bool flickedY = d->flickY(yVelocity); + + if (flickedX) + d->hMoved = true; + if (flickedY) + d->vMoved = true; + movementStarting(); d->flickingStarted(flickedX, flickedY); } |