summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2014-02-11 10:47:30 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-12 14:54:24 +0100
commit77d1b56b136595b898432ec4de982e3eaa9533f3 (patch)
treeba46bac6fb224c4e007afd3b00457e983b138615
parent14dc46ee4dc05e78b227910f38e7f97f87004290 (diff)
downloadqtlocation-77d1b56b136595b898432ec4de982e3eaa9533f3.tar.gz
Grab mouse when a gesture is detected.
If the mouse is not grabbed when a gesture is detected both the map and any MouseArea end up handling the same mouse events. Change-Id: I62d2a576250484f465b8c60f8ab60aad032b1490 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 8310fd48..a4d86b84 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -812,19 +812,23 @@ bool QDeclarativeGeoMap::childMouseEventFilter(QQuickItem *item, QEvent *event)
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
- if (!item->keepMouseGrab())
- return gestureArea_->filterMapChildMouseEvent(static_cast<QMouseEvent *>(event));
- else
+ if (item->keepMouseGrab())
return false;
+ if (!gestureArea_->filterMapChildMouseEvent(static_cast<QMouseEvent *>(event)))
+ return false;
+ grabMouse();
+ return true;
case QEvent::UngrabMouse:
return gestureArea_->filterMapChildMouseEvent(static_cast<QMouseEvent *>(event));
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
- if (!item->keepMouseGrab())
- return gestureArea_->filterMapChildTouchEvent(static_cast<QTouchEvent *>(event));
- else
+ if (item->keepMouseGrab())
+ return false;
+ if (!gestureArea_->filterMapChildTouchEvent(static_cast<QTouchEvent *>(event)))
return false;
+ grabMouse();
+ return true;
case QEvent::Wheel:
return gestureArea_->wheelEvent(static_cast<QWheelEvent *>(event));
default: