diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-03-05 16:30:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 15:17:21 +0100 |
commit | 2a39fa47c26453fbc6d200dce7eb01d40cdf259a (patch) | |
tree | 67a2295e5cda471a4584008900c93ddcdea6be05 /src/quick/items/qquickpincharea.cpp | |
parent | 5a9b5148a1d3fb412ab9bae276c10ba1a44374b1 (diff) |
Release the mouse grab from PinchArea when it's not needed anymore
If we keep the mouse grabbed no other items will receive mouse events
until the next click.
Task-number: QTBUG-37485
Change-Id: Id3936fbe09b262ddbefc68334ef8fe7e161fbcd4
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/quick/items/qquickpincharea.cpp')
-rw-r--r-- | src/quick/items/qquickpincharea.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index e58dfad5c1..99c50b0c9a 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -333,6 +333,14 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event) void QQuickPinchArea::updatePinch() { Q_D(QQuickPinchArea); + + if (d->touchPoints.count() < 2) { + setKeepMouseGrab(false); + QQuickWindow *c = window(); + if (c && c->mouseGrabberItem() == this) + ungrabMouse(); + } + if (d->touchPoints.count() == 0) { if (d->inPinch) { d->inPinch = false; @@ -355,14 +363,9 @@ void QQuickPinchArea::updatePinch() d->initPinch = false; d->pinchRejected = false; d->stealMouse = false; - setKeepMouseGrab(false); return; } - if (d->touchPoints.count() == 1) { - setKeepMouseGrab(false); - } - QTouchEvent::TouchPoint touchPoint1 = d->touchPoints.at(0); QTouchEvent::TouchPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0); QRectF bounds = clipRect(); |