qt5base-lts/tests/auto/widgets/graphicsview
Volker Hilsheimer 4982c872ef Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidget
For high-precision wheel scrolling sequences, the widget that gets
the first (typically ScrollBegin) event grabs the wheel. Qt directs
all future wheel events within the same sequence (i.e. until ScrollEnd)
to that widget.

QGraphicsView passes wheel events through to the item under the mouse,
and QGraphicsProxyWidget implements wheelEvent to forward a synthesized
QWheelEvent to the embedded widget. Since QGraphicsView's viewport has
already grabbed the wheel, any forwarded event would end up back in
QGraphicsView, resulting in infinite recursion (if the assert doesn't
fail first in debug builds).

The correct fix requires that QGraphicsProxyWidget knows that this is
a high-precision wheel event, allowing it to adjust the wheel grabber
temporarily to the embedded widget. However, QGraphicsSceneWheelEvent
doesn't provide this information.

To fix the infinite recursion, mark the generated event as synthesized
by Qt (but still send it spontaneously to enable propagarion within
the proxy widget hierarchy). In QApplication's notification routine,
interpret such events then to override the wheel grabber.

Add a test case for the various scenarios. This 6.1 compatible fix
does not pass all situations. A follow up commit that introduces the
missing APIs to QGraphicsSceneWheelEvent then fixes those as well.

Task-number: QTBUG-95552
Pick-to: 6.1 6.2
Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-08-16 18:37:26 +02:00
..
qgraphicsanchorlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsanchorlayout1 Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicseffectsource Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsgridlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsitem Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsitemanimation Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicslayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicslayoutitem Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicslinearlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsobject Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicspixmapitem Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicspolygonitem Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsproxywidget Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsscene testlib: Deprecate QWARN() in favor of qWarning() 2021-08-04 19:31:51 +02:00
qgraphicssceneindex Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicstransform Remove the qmake project files 2021-01-07 15:32:28 +01:00
qgraphicsview Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidget 2021-08-16 18:37:26 +02:00
qgraphicswidget Remove the qmake project files 2021-01-07 15:32:28 +01:00
CMakeLists.txt Android: exclude tests crashing at start 2020-11-16 13:35:44 +02:00