aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmousearea.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-03-14 12:16:33 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-29 11:30:01 +0000
commitfd1cfc2e7b40e2cd6118a7ad805f351cce9c293a (patch)
treeec32ffa1fc9b132cef505283576a530d8b5e207d /src/quick/items/qquickmousearea.cpp
parent5a9bc50efa5d9cb74e93be0becb2ce8e6b76689b (diff)
QQuickMouseArea: let MouseArea reject hover events
From testing Qt 6.1, a MouseArea should not accept hover events, and as such, block hover events from propagating. This patch will make sure that QQuickMouseArea rejects hover events, and thereby restore the behavior Qt had up till Qt 6.1. Fixes: QTBUG-95726 Fixes: QTBUG-95398 Change-Id: I1b929092a3004dd47ef1b6d1a957837ccedc7390 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit 56a075341514db1242a0852ccf0fbe98e1fcabbc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/quick/items/qquickmousearea.cpp')
-rw-r--r--src/quick/items/qquickmousearea.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 281860fa6e..11a764b9be 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -849,14 +849,8 @@ void QQuickMouseArea::hoverEnterEvent(QHoverEvent *event)
me.setPosition(d->lastPos);
}
- if (auto parentMouseArea = qobject_cast<QQuickMouseArea *>(parentItem())) {
- if (parentMouseArea->acceptHoverEvents()) {
- // Special legacy case: if our parent is another MouseArea, and we're
- // hovered, the parent MouseArea should be hovered too. We achieve this
- // by simply ignoring the event to not block propagation.
- event->ignore();
- }
- }
+ // A MouseArea should not block hover events
+ event->ignore();
}
void QQuickMouseArea::hoverMoveEvent(QHoverEvent *event)
@@ -876,14 +870,8 @@ void QQuickMouseArea::hoverMoveEvent(QHoverEvent *event)
emit positionChanged(&me);
}
- if (auto parentMouseArea = qobject_cast<QQuickMouseArea *>(parentItem())) {
- if (parentMouseArea->acceptHoverEvents()) {
- // Special legacy case: if our parent is another MouseArea, and we're
- // hovered, the parent MouseArea should be hovered too. We achieve this
- // by simply ignoring the event to not block propagation.
- event->ignore();
- }
- }
+ // A MouseArea should not block hover events
+ event->ignore();
}
void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
@@ -894,14 +882,8 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
else
setHovered(false);
- if (auto parentMouseArea = qobject_cast<QQuickMouseArea *>(parentItem())) {
- if (parentMouseArea->acceptHoverEvents()) {
- // Special legacy case: if our parent is another MouseArea, and we're
- // hovered, the parent MouseArea should be hovered too. We achieve this
- // by simply ignoring the event to not block propagation.
- event->ignore();
- }
- }
+ // A MouseArea should not block hover events
+ event->ignore();
}
#if QT_CONFIG(wheelevent)