Skip to content

Correct the misgenerated localMouseEvent

Aki Sakurai requested to merge aki1/oxygen:fix-mouse-event into master

This commit fixes the issue where some parts of Qt6 widgets couldn't be clicked with a Wacom tablet stylus.

  1. QMouseEvent is constructed with incorrect arguments.

https://doc.qt.io/qt-6/qmouseevent.html#QMouseEvent-3

The button that caused the event is given as a value from the Qt::MouseButton enum. If the event type is MouseMove, the appropriate button for this event is Qt::NoButtonbuttons is the state of all buttons at the time of the event, modifiers is the state of all keyboard modifiers.

  1. Some parts of Qt widgets require a timestamp to function properly. https://codereview.qt-project.org/c/qt/qtdeclarative/+/493020

QQuickWidget: give each mapped mouse event the same QEventPoint Counter-intuitively, this is done by setting the timestamp. Every time you construct a new mouse event, you always need to call setTimestamp() for the obvious reason: the timestamp is not a ctor argument, but it's important for some event receivers. But the non-obvious reason is that QMutableEventPoint::setTimestamp() has other useful side effects: the velocity calculation is done there, sensibly enough. But to make that possible, it also looks up the persistent QEventPoint with the same ID as the one in the QMouseEvent, and that's the most important to fix QTBUG-114258 specifically. QQuickFlickablePrivate::handleMoveEvent() calculates delta as QEventPoint::position() - mapFromGlobal(globalPressPosition()) and then QQuickFlickablePrivate::drag() does the drag threshold check. If globalPressPosition() is 0,0 because the persistent QEventPoint

Edited by Aki Sakurai

Merge request reports