summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-08-24 13:22:52 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-08-26 09:36:25 +0200
commit6bf70bc0144ca29939a1db6757ed586b015fc3d2 (patch)
tree9c6eb79fdc91332144253d7adacdc879902abf6d /src/widgets/kernel/qapplication.cpp
parent1ecf2212fae176b78c9951a37df9e33eb24d4f2d (diff)
Refactor QApplication::translateRawTouchEvent to take a QTouchEvent*
Both call sites just pass the data from an existing QTouchEvent through, so just pass the QTouchEvent through instead. Amends 20d4f45a132606f7a910050d468519108486e9cf. Pick-to: 6.2 Change-Id: If3b9508b83311889b58e109e7f64743985b8b178 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r--src/widgets/kernel/qapplication.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index b97383115a..6dba04d284 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3916,17 +3916,15 @@ void QApplicationPrivate::activateImplicitTouchGrab(QWidget *widget, QTouchEvent
// TODO setExclusiveGrabber() to be consistent with Qt Quick?
}
-bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
- const QPointingDevice *device,
- QList<QEventPoint> &touchPoints,
- ulong timestamp,
- bool spontaneous)
+bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, const QTouchEvent *te)
{
QApplicationPrivate *d = self;
// TODO get rid of this QPair
typedef QPair<QEventPoint::State, QList<QEventPoint> > StatesAndTouchPoints;
QHash<QWidget *, StatesAndTouchPoints> widgetsNeedingEvents;
+ const auto *device = te->pointingDevice();
+ auto touchPoints = te->points(); // touch points will be mutated
for (auto &touchPoint : touchPoints) {
// update state
QPointer<QObject> target;
@@ -4011,7 +4009,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QMutableTouchEvent touchEvent(eventType, device, QGuiApplication::keyboardModifiers(),
it.value().second);
bool containsPress = updateTouchPointsForWidget(widget, &touchEvent);
- touchEvent.setTimestamp(timestamp);
+ touchEvent.setTimestamp(te->timestamp());
touchEvent.setTarget(widget);
if (containsPress)
@@ -4022,8 +4020,8 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
{
// if the TouchBegin handler recurses, we assume that means the event
// has been implicitly accepted and continue to send touch events
- bool res = spontaneous ? QApplication::sendSpontaneousEvent(widget, &touchEvent)
- : QApplication::sendEvent(widget, &touchEvent);
+ bool res = te->spontaneous() ? QApplication::sendSpontaneousEvent(widget, &touchEvent)
+ : QApplication::sendEvent(widget, &touchEvent);
if (res && touchEvent.isAccepted()) {
accepted = true;
if (!widget.isNull())
@@ -4037,8 +4035,8 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
|| QGestureManager::gesturePending(widget)
#endif
) {
- bool res = spontaneous ? QApplication::sendSpontaneousEvent(widget, &touchEvent)
- : QApplication::sendEvent(widget, &touchEvent);
+ bool res = te->spontaneous() ? QApplication::sendSpontaneousEvent(widget, &touchEvent)
+ : QApplication::sendEvent(widget, &touchEvent);
if (res && touchEvent.isAccepted())
accepted = true;
// widget can be deleted on TouchEnd