Skip to content
Commit b050ab3b authored by Aki Sakurai's avatar Aki Sakurai Committed by Nate Graham
Browse files

Correct the misgenerated localMouseEvent

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, then
the appropriate button for this event is Qt::NoButton. _buttons_
is the state of all buttons at the time of the event, _modifiers_
is the state of all keyboard modifiers.

2. 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.

CCBUG:473125
parent dbbccd1d
Pipeline #501838 passed with stage
in 2 minutes and 58 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment