diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-07-14 16:11:24 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-15 16:59:45 +0000 |
commit | a0be1dc746b2dc23ef8fff2f0e3b4224d9d74c81 (patch) | |
tree | 8cb1faf21a43ece476fea2472db7c41b58012005 /src/quick/handlers/qquickhoverhandler.cpp | |
parent | 5c1268f13a69cacae17d4dcc364f8fdfee1ca24c (diff) |
HoverHandler: don't change state if the event involves buttons
In the bug, HoverHandler was getting "hovered" during clicking, even
though it already had the opportunity to be hovered while the mouse
got into its parent's bounds (and at that time, it got un-hovered while
Button was hovered instead). It gets hovered because
QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem() calls
QQuickItemPrivate::handlePointerEvent() on the ListView's contentItem,
because it has a handler. So it seems HoverHandler should not react to
that event, because a button is being pressed.
Fixes: QTBUG-72843
Change-Id: I0bbcd351130a8d16165f04809c039b24b3864bf9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8449180c5ebd609b6788680173a79df2f239abb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/handlers/qquickhoverhandler.cpp')
-rw-r--r-- | src/quick/handlers/qquickhoverhandler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp index e3b60ad9c6..e953a5b311 100644 --- a/src/quick/handlers/qquickhoverhandler.cpp +++ b/src/quick/handlers/qquickhoverhandler.cpp @@ -109,6 +109,9 @@ void QQuickHoverHandler::componentComplete() bool QQuickHoverHandler::wantsPointerEvent(QPointerEvent *event) { + // No state change should occur if a button is being pressed or released. + if (event->isSinglePointEvent() && static_cast<QSinglePointEvent *>(event)->button()) + return false; auto &point = event->point(0); if (QQuickPointerDeviceHandler::wantsPointerEvent(event) && wantsEventPoint(event, point) && parentContains(point)) { // assume this is a mouse or tablet event, so there's only one point |