diff options
author | Martin Jones <martin.jones@jollamobile.com> | 2012-11-26 09:33:20 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-26 02:00:02 +0100 |
commit | 429af6244518172e19abf7fecd7112f26bac6b31 (patch) | |
tree | 13d5f0f442556721929655ce315d72d73a4765e9 /src/quick/items/qquickflickable.cpp | |
parent | 417403f803c03d177c8563878e06b95a15f0d4df (diff) |
Nested Flickables with pressDelay flick incorrect Flickable
If the gesture is triggered within the pressDelay the outer Flickable
will always handle the gesture. When the drag distance is exceeded
replay the press event to allow all Flickables an opportunity to
process the gesture normally.
Task-number: QTBUG-28189
Change-Id: I36912cc19a48c90ae7a9a430580a8f40071bd5fd
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index a0bd1fab8e..105989c7f1 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2007,6 +2007,22 @@ bool QQuickFlickable::sendMouseEvent(QMouseEvent *event) switch (mouseEvent->type()) { case QEvent::MouseMove: + if (d->delayedPressEvent) { + // A move beyond the threshold replays the press to give nested Flickables + // the opportunity to grab the gesture. + QPointF delta = event->localPos() - d->delayedPressEvent->localPos(); + if (QQuickWindowPrivate::dragOverThreshold(qAbs(delta.x()), Qt::XAxis, event) + || QQuickWindowPrivate::dragOverThreshold(qAbs(delta.y()), Qt::YAxis, event)) { + // We replay the mouse press but the grabber we had might not be interested in the event (e.g. overlay) + // so we reset the grabber + if (c->mouseGrabberItem() == d->delayedPressTarget) + d->delayedPressTarget->ungrabMouse(); + // Use the event handler that will take care of finding the proper item to propagate the event + QQuickWindowPrivate::get(window())->deliverMouseEvent(d->delayedPressEvent); + d->clearDelayedPress(); + // continue on to handle mouse move event + } + } d->handleMouseMoveEvent(mouseEvent.data()); break; case QEvent::MouseButtonPress: |