diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-29 12:07:33 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-30 09:08:23 +0200 |
commit | b1493678fc295765ce93e565c5194e860e746436 (patch) | |
tree | 33b056e122f20ff2ea8b90be78194649558df9f5 /src/quick/items/qquickwindow.cpp | |
parent | 71fb4c17a4d58fb558194431a30dd2a9cd9edba1 (diff) |
Change the cursor within HoverHandler.margin
The visual cursor feedback was inconsistent with the hovered property
when a margin is set.
Amends 1c44804600ad3dbeb60d1f5209ce9cf937d30ab3
Pick-to: 5.15
Fixes: QTBUG-85303
Task-number: QTBUG-68073
Change-Id: I25506baecaecbd6450a0e95786f103024b46b1b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 20a90abe21..2b3f788201 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3315,15 +3315,19 @@ QPair<QQuickItem*, QQuickPointerHandler*> QQuickWindowPrivate::findCursorItemAnd if (ret.first) return ret; } - if (itemPrivate->hasCursor || itemPrivate->hasCursorHandler) { - QPointF p = item->mapFromScene(scenePos); - if (!item->contains(p)) - return {nullptr, nullptr}; - if (itemPrivate->hasCursorHandler) { - if (auto handler = itemPrivate->effectiveCursorHandler()) + if (itemPrivate->hasCursorHandler) { + if (auto handler = itemPrivate->effectiveCursorHandler()) { + QQuickPointerEvent *pointerEvent = pointerEventInstance(QPointingDevice::primaryPointingDevice(), QEvent::MouseMove); + pointerEvent->point(0)->reset(Qt::TouchPointMoved, scenePos, quint64(1) << 24 /* mouse has device ID 1 */, 0); + pointerEvent->point(0)->setAccepted(true); + pointerEvent->localize(item); + if (handler->parentContains(pointerEvent->point(0))) return {item, handler}; } - if (itemPrivate->hasCursor) + } + if (itemPrivate->hasCursor) { + QPointF p = item->mapFromScene(scenePos); + if (item->contains(p)) return {item, nullptr}; } } |