aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Belyavsky <belyavskyv@gmail.com>2022-12-14 12:55:16 +0300
committerVladimir Belyavsky <belyavskyv@gmail.com>2022-12-17 07:29:06 +0300
commit1309bac26b71d184c924237ba3c8723aa79b5ba1 (patch)
tree83c412f16721c8d46eb02be6187b8676338c59dd
parente9b7eaaf6e627c84cf77dc0ea76c9cb40d705711 (diff)
QQDAPrivate::deliverUpdatedPoints: skip HoverHandlers if wheel event
This complements 85db031c3f449cbeba41eb5667cf6725cca8b32d. When delivering a mouse wheel event, we shouldn't just pass it to the item's HoverHandler, because those are normally visited in QQuickDeliveryAgentPrivate::deliverHoverEventToItem(). Pick-to: 6.4 6.5 Fixes: QTBUG-108600 Fixes: QTBUG-108601 Change-Id: Ie6066807f80140e1007347413f1095f98f6cb5c0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/quick/items/qquickitem.cpp6
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp5
-rw-r--r--src/quick/util/qquickdeliveryagent_p_p.h1
3 files changed, 9 insertions, 3 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 32009939df..ccbb8c557f 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -5561,8 +5561,8 @@ bool QQuickItemPrivate::anyPointerHandlerWants(const QPointerEvent *event, const
/*!
\internal
Deliver the \a event to all this item's PointerHandlers, but skip
- HoverHandlers if the event is a QMouseEvent (they are visited in
- QQuickDeliveryAgentPrivate::deliverHoverEventToItem()), and skip handlers
+ HoverHandlers if the event is a QMouseEvent or QWheelEvent (they are visited
+ in QQuickDeliveryAgentPrivate::deliverHoverEventToItem()), and skip handlers
that are in QQuickPointerHandlerPrivate::deviceDeliveryTargets().
If \a avoidGrabbers is true, also skip delivery to any handler that
is exclusively or passively grabbing any point within \a event
@@ -5574,7 +5574,7 @@ bool QQuickItemPrivate::handlePointerEvent(QPointerEvent *event, bool avoidGrabb
if (extra.isAllocated()) {
for (QQuickPointerHandler *handler : extra->pointerHandlers) {
bool avoidThisHandler = false;
- if (QQuickDeliveryAgentPrivate::isMouseEvent(event) &&
+ if (QQuickDeliveryAgentPrivate::isMouseOrWheelEvent(event) &&
qmlobject_cast<const QQuickHoverHandler *>(handler)) {
avoidThisHandler = true;
} else if (avoidGrabbers) {
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
index 97ca80dc78..794ac70a25 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -1389,6 +1389,11 @@ bool QQuickDeliveryAgentPrivate::isMouseEvent(const QPointerEvent *ev)
}
}
+bool QQuickDeliveryAgentPrivate::isMouseOrWheelEvent(const QPointerEvent *ev)
+{
+ return isMouseEvent(ev) || ev->type() == QEvent::Wheel;
+}
+
bool QQuickDeliveryAgentPrivate::isHoverEvent(const QPointerEvent *ev)
{
switch (ev->type()) {
diff --git a/src/quick/util/qquickdeliveryagent_p_p.h b/src/quick/util/qquickdeliveryagent_p_p.h
index efd3431817..66db4bc88c 100644
--- a/src/quick/util/qquickdeliveryagent_p_p.h
+++ b/src/quick/util/qquickdeliveryagent_p_p.h
@@ -139,6 +139,7 @@ public:
static bool anyPointGrabbed(const QPointerEvent *ev);
static bool allPointsGrabbed(const QPointerEvent *ev);
static bool isMouseEvent(const QPointerEvent *ev);
+ static bool isMouseOrWheelEvent(const QPointerEvent *ev);
static bool isHoverEvent(const QPointerEvent *ev);
static bool isTouchEvent(const QPointerEvent *ev);
static bool isTabletEvent(const QPointerEvent *ev);