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
92df790f46.

Task-number: QTBUG-95552
Task-number: QTBUG-79102
Task-number: QTBUG-67032
Pick-to: 6.1 6.2
Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Volker Hilsheimer 2021-08-13 10:46:00 +02:00
parent 864ecea83b
commit 1653ae13db

View File

@ -2979,6 +2979,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();