summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-10-03 17:19:12 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-01-25 12:26:57 +0000
commit68b5ee9e7064f66fd7e7bd69b4b51229dbe8cc3c (patch)
treef4427a7f6eae695897cdfba1d1d617775c095475
parent765ec408b3b355b37c04f52dc6c477e3dca3e3f8 (diff)
downloadqtlocation-68b5ee9e7064f66fd7e7bd69b4b51229dbe8cc3c.tar.gz
Clarify operation of QDeclarativeGeoMapItemBase::childMouseEventFilter
Change-Id: I06353153980659bf9370705b2d7f4263d066bdad Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
index 729825fd..bb503cd3 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
@@ -214,9 +214,14 @@ bool QDeclarativeGeoMapItemBase::childMouseEventFilter(QQuickItem *item, QEvent
{
Q_UNUSED(item)
if (event->type() == QEvent::MouseButtonPress && !contains(static_cast<QMouseEvent*>(event)->pos())) {
- // This is an evil hack: in case of items that are not rectangles, we never accept the event.
- // Instead the events are now delivered to QDeclarativeGeoMapItemBase which doesn't to anything with them.
- // The map below it still works since it filters events and steals the events at some point.
+ // In case of items that are not rectangles, this filter is used to test if the event has landed
+ // inside the actual item shape.
+ // If so, the method returns true, meaning that it prevents the event delivery to child "*item" (for example,
+ // a mouse area that is on top of this map item).
+ // However, this method sets "accepted" to false, so that the event can still be passed further up,
+ // specifically to the parent Map, that is a sort of flickable.
+ // Otherwise, if the event is not contained within the map item, the method returns false, meaning the event
+ // is delivered to the child *item (like the mouse area associated).
event->setAccepted(false);
return true;
}