aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-07-14 16:11:24 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-07-15 13:29:56 +0200
commit8449180c5ebd609b6788680173a79df2f239abb8 (patch)
tree9e720f2a981fd9a1eae44ed131d0f253349dca82 /src/quick/handlers
parent483d8d6165327ce8cfaa5493904ca4932a09b3fe (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 Pick-to: 5.15 6.1 6.2 Change-Id: I0bbcd351130a8d16165f04809c039b24b3864bf9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r--src/quick/handlers/qquickhoverhandler.cpp3
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