diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-16 15:00:08 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-11-18 09:53:04 +0100 |
commit | d63ad7efb56452e3ad019c38ddf887ddcc8d338a (patch) | |
tree | d0a4f58cdd05357869ed5f76faa21d7a7a6d76b1 /src/quick/items/qquickitem.cpp | |
parent | da9b9a4e6e2cddd6dd1dbf2e126fc2d332bc0616 (diff) |
Use QMutable*Event classes to copy and synthesize events
QMutableTouch/SinglePointEvent can be publicly copy constructed from their
non-mutable counterparts, make use of that.
Change-Id: I7f56a9f9649bb7726cca1eaddccfdc3f21d47554
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 116d1a370b..5dcc191053 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -8389,7 +8389,7 @@ QQuickItemLayer *QQuickItemPrivate::layer() const monitor eventpoint movements until a drag threshold is exceeded or the requirements for a gesture to be recognized are met in some other way. */ -QTouchEvent QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, bool isFiltering) +void QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, bool isFiltering, QMutableTouchEvent *localized) { Q_Q(QQuickItem); QList<QEventPoint> touchPoints; @@ -8449,8 +8449,10 @@ QTouchEvent QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, boo // Now touchPoints will have only points which are inside the item. // But if none of them were just pressed inside, and the item has no other reason to care, ignore them anyway. - if (touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering)) - return QTouchEvent(QEvent::None); + if (touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering)) { + *localized = QMutableTouchEvent(QEvent::None); + return; + } // if all points have the same state, set the event type accordingly QEvent::Type eventType = event->type(); @@ -8470,7 +8472,7 @@ QTouchEvent QQuickItemPrivate::localizedTouchEvent(const QTouchEvent *event, boo ret.setTarget(q); ret.setTimestamp(event->timestamp()); ret.accept(); - return ret; + *localized = ret; } bool QQuickItemPrivate::hasPointerHandlers() const |