diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-13 20:56:01 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-13 20:56:01 +0200 |
commit | 1fb1c6c4f8769250dffa375e3941738eb1fcc885 (patch) | |
tree | 4f4c4afae97b54a793a0589f8ca53b7c919de728 /src/quick/items/qquickevents.cpp | |
parent | d0ce320646b7f852a24f6e0a9e9621ddcedef554 (diff) | |
parent | 9c1c471e54bb12e8740b76d1c048f2f916a6ab59 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Change-Id: Ie2894830470a69827d4ace3d8af9bee971e3fbd4
Diffstat (limited to 'src/quick/items/qquickevents.cpp')
-rw-r--r-- | src/quick/items/qquickevents.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 2671b9c9a2..19dd81b6fc 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -195,8 +195,8 @@ Item { */ /*! - \qmlproperty int QtQuick::MouseEvent::x - \qmlproperty int QtQuick::MouseEvent::y + \qmlproperty real QtQuick::MouseEvent::x + \qmlproperty real QtQuick::MouseEvent::y These properties hold the coordinates of the position supplied by the mouse event. */ @@ -342,8 +342,8 @@ Item { */ /*! - \qmlproperty int QtQuick::WheelEvent::x - \qmlproperty int QtQuick::WheelEvent::y + \qmlproperty real QtQuick::WheelEvent::x + \qmlproperty real QtQuick::WheelEvent::y These properties hold the coordinates of the position supplied by the wheel event. */ @@ -1225,9 +1225,24 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i auto p = m_touchPoints.at(i); if (p->isAccepted()) continue; + // include points where item is the grabber bool isGrabber = p->exclusiveGrabber() == item; + // include newly pressed points inside the bounds bool isPressInside = p->state() == QQuickEventPoint::Pressed && item->contains(item->mapFromScene(p->scenePos())); - if (!(isGrabber || isPressInside || isFiltering)) + + // filtering: (childMouseEventFilter) include points that are grabbed by children of the target item + bool grabberIsChild = false; + auto parent = p->grabberItem(); + while (isFiltering && parent) { + if (parent == item) { + grabberIsChild = true; + break; + } + parent = parent->parentItem(); + } + bool filterRelevant = isFiltering && grabberIsChild; + + if (!(isGrabber || isPressInside || filterRelevant)) continue; const QTouchEvent::TouchPoint *tp = touchPointById(p->pointId()); |