diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-07 12:26:21 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-01-14 12:32:30 +0000 |
commit | 31669722d95b3fb86c2090956976ba75457b443e (patch) | |
tree | 6f36d32e9f8992e667545620f64678136e5cc968 /src/gui/kernel/qguiapplication.cpp | |
parent | 3215416e3c07e662f5ea99c82d4f8b08340be005 (diff) |
QGuiApplication: port the last user of QMutableEventPoint::from()
... to the new static setter API, preventing the undefined behavior
that from() depended on.
Remove from() and constFrom().
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: I69c52aa286eaf51303734e42184af36815cf828a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 5ace7049c7..51de8580f7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2849,7 +2849,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To for (auto &tempPt : e->points) { // update state auto epd = devPriv->pointById(tempPt.id()); - auto &mut = QMutableEventPoint::from(epd->eventPoint); + auto &ep = epd->eventPoint; epd->eventPoint.setAccepted(false); switch (tempPt.state()) { case QEventPoint::State::Pressed: @@ -2859,19 +2859,21 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To // If the QPA event didn't tell us which window, find the one under the touchpoint position. if (!window) window = QGuiApplication::topLevelAt(tempPt.globalPosition().toPoint()); - mut.setWindow(window); + QMutableEventPoint::setWindow(ep, window); break; case QEventPoint::State::Released: - if (Q_UNLIKELY(!window.isNull() && window != mut.window())) - qCWarning(lcPtrDispatch) << "delivering touch release to same window" << mut.window() << "not" << window.data(); - window = mut.window(); + if (Q_UNLIKELY(!window.isNull() && window != QMutableEventPoint::window(ep))) + qCWarning(lcPtrDispatch) << "delivering touch release to same window" + << QMutableEventPoint::window(ep) << "not" << window.data(); + window = QMutableEventPoint::window(ep); break; default: // update or stationary - if (Q_UNLIKELY(!window.isNull() && window != mut.window())) - qCWarning(lcPtrDispatch) << "delivering touch update to same window" << mut.window() << "not" << window.data(); - window = mut.window(); + if (Q_UNLIKELY(!window.isNull() && window != QMutableEventPoint::window(ep))) + qCWarning(lcPtrDispatch) << "delivering touch update to same window" + << QMutableEventPoint::window(ep) << "not" << window.data(); + window = QMutableEventPoint::window(ep); break; } // If we somehow still don't have a window, we can't deliver this touchpoint. (should never happen) @@ -2879,30 +2881,30 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To qCWarning(lcPtrDispatch) << "skipping" << &tempPt << ": no target window"; continue; } - mut.updateFrom(tempPt); + QMutableEventPoint::update(tempPt, ep); Q_ASSERT(window.data() != nullptr); // make the *scene* position the same as the *global* position - mut.setScenePosition(tempPt.globalPosition()); + QMutableEventPoint::setScenePosition(ep, tempPt.globalPosition()); // store the scene position as local position, for now - mut.setPosition(window->mapFromGlobal(tempPt.globalPosition())); + QMutableEventPoint::setPosition(ep, window->mapFromGlobal(tempPt.globalPosition())); // setTimeStamp has side effects, so we do it last - mut.setTimestamp(e->timestamp); + QMutableEventPoint::setTimestamp(ep, e->timestamp); // add the touchpoint to the event that will be delivered to the window bool added = false; for (QMutableTouchEvent &ev : touchEvents) { if (ev.target() == window.data()) { - ev.addPoint(mut); + ev.addPoint(ep); added = true; break; } } if (!added) { - QMutableTouchEvent mte(e->touchType, device, e->modifiers, {mut}); + QMutableTouchEvent mte(e->touchType, device, e->modifiers, {ep}); mte.setTimestamp(e->timestamp); mte.setTarget(window.data()); touchEvents.append(mte); |