When a pen stylus is hovering and moving on another QWidget, pressing a QML button in a QQuickWidget may cause it to be triggered twice.
Attached is a test project. To reproduce:
- Hover pen stylus on the right-hand area and move it around continuously.
- Press the button on the left-hand side using touchscreen.
- Observe the "Button is pressed" message in the console.
Sometimes you can see two "Button is pressed" messages printed consecutively.
My suspect is the change in https://codereview.qt-project.org/c/qt/qtbase/+/267594, which was supposed to fix
QTBUG-76617. The code checks for the last WM_POINTERUPDATE / WM_POINTER* pointer type to set Qt::MouseEventSynthesizedBySystem, which in theory could fail to work properly if the WM_POINTERUP and WM_LBUTTONDOWN messages produced from the touch press event is interleaved with a WM_POINTERUPDATE message from the pen movement.
It probably is still reproducible on Qt 5.15.* and 6 but I cannot test it locally for now.