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 14:32:57 +0200 |
commit | a81c111dd056efbd37b6267871367f3d975a1078 (patch) | |
tree | c3c410502ef2c2bc6a0ba0b18f6a29d433bea416 /src/quick | |
parent | 1686104675b66fff6c0196b812312825913e8755 (diff) |
Change the cursor within HoverHandler.margin
The visual cursor feedback was inconsistent with the hovered property
when a margin is set.
Amends 1c44804600ad3dbeb60d1f5209ce9cf937d30ab3
Fixes: QTBUG-85303
Task-number: QTBUG-68073
Change-Id: I25506baecaecbd6450a0e95786f103024b46b1b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b1493678fc295765ce93e565c5194e860e746436)
Diffstat (limited to 'src/quick')
-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 1b7315688b..906d59e6d3 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3138,15 +3138,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(QQuickPointerDevice::genericMouseDevice(), 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}; } } |