diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-07 16:57:09 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-10-08 10:11:31 +0200 |
commit | 8d9819734516a2fe0853acfd0b2cfd3364465c7a (patch) | |
tree | 2e2a6a16551f25ee81ffda1c42b06256fafbd485 /src/quick/items/qquickwindow.cpp | |
parent | 61417ad3525d33c41e7d8423103e876a922d5f8b (diff) |
Prevent touch->mouse synth from altering the localized touchpoint
QEventPoint is explicitly shared, so a QMouseEvent synthesized from
a QTouchEvent shared the same QEventPoint instance.
When QQuickFlickable::filterMouseEvent() calls cloneMouseEvent(),
it was re-localizing the point for the flickable, after it had
already been localized for delivery to the original receiver item.
This caused a lot of failures in Controls, e.g. for any button inside
a Flickable, QQuickAbstractButtonPrivate::handlePress() would be given
the wrong position.
After filtering, we need to be able to resume delivery to the
original receiver item without re-localizing the point.
During filtering, the filtering parent should receive the same version
of the touch event that contains only the points that would be sent
to the receiver item, not the potentially more-complete original event.
Fixes: QTBUG-87157
Change-Id: I7eec6f5ecfe9f042199f0944897c04fbffb2172e
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquickwindow.cpp')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 45c203ebbf..c54df960cf 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2044,7 +2044,8 @@ void QQuickWindowPrivate::deliverKeyEvent(QKeyEvent *e) QMouseEvent *QQuickWindowPrivate::cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos) { QMouseEvent *me = new QMouseEvent(*event); - QMutableEventPoint &point = QMutableEventPoint::from(event->point(0)); + QMutableEventPoint &point = QMutableEventPoint::from(me->point(0)); + point.detach(); point.setTimestamp(event->timestamp()); point.setPosition(transformedLocalPos ? *transformedLocalPos : event->position()); return me; @@ -2902,7 +2903,7 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, bool isG // If any parent filters the event, we're done. hasFiltered.clear(); - if (sendFilteredPointerEvent(pointerEvent, item)) + if (sendFilteredPointerEvent(&touchEvent, item)) return; // Deliver the touch event to the given item |