From e510a6eefade03be5d385c4969869b388d8fce8f Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 13 Aug 2021 10:46:00 +0200 Subject: [PATCH] Accept the QWheelEvent before each propagation step Input events in Qt are accepted when constructed, and ignored by the default event handler (so overriding the event handler is enough to accept an event). Since we use the same QWheelEvent instance for each propagation step, we need to reset the event to be accepted before each delivery so that an earlier child ignoring the event doesn't result in the event being ignored without explicit acceptance. Amends the refactoring of wheel event delivery in 92df790f46b3a8b17aec2f385d6472fd3f8647f6. Task-number: QTBUG-95552 Task-number: QTBUG-79102 Task-number: QTBUG-67032 Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848 Reviewed-by: Shawn Rutledge Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 1653ae13db69a2e703a1b44d3e67b55e927a5eca) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/kernel/qapplication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index b1341d10151..059617eb831 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2982,6 +2982,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e) we.setTimestamp(wheel->timestamp()); bool eventAccepted; do { + // events are delivered as accepted and ignored by the default event handler + // since we always send the same QWheelEvent object, we need to reset the accepted state + we.setAccepted(true); we.m_spont = wheel->spontaneous() && w == receiver; res = d->notify_helper(w, &we); eventAccepted = we.isAccepted();