diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-06 13:53:17 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-01-08 09:00:10 +0000 |
commit | ae49252dbcc21de1dccee03c54a8e0986c5a0acc (patch) | |
tree | b2e506cc41d991bf3ceeacee8ea254f560cf44b1 /src/widgets/kernel/qtestsupport_widgets.cpp | |
parent | 12c56aa43a7c48f7f34e75c3a7fb1603102f1af5 (diff) |
QMutableEventPoint: add static overloads of setters
These overloads don't require a cast from QEventPoint to
QMutableEventPoint, thus avoiding undefined behavior.
Port easy users of QMutableEventPosition::(const)from()
to the new API.
Pick-to: 6.3
Task-number: QTBUG-99615
Change-Id: I4e9228322134ef7c712ca478ee8286466efc3585
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/kernel/qtestsupport_widgets.cpp')
-rw-r--r-- | src/widgets/kernel/qtestsupport_widgets.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/widgets/kernel/qtestsupport_widgets.cpp b/src/widgets/kernel/qtestsupport_widgets.cpp index c9116fcef6..9c5603fc5a 100644 --- a/src/widgets/kernel/qtestsupport_widgets.cpp +++ b/src/widgets/kernel/qtestsupport_widgets.cpp @@ -100,30 +100,30 @@ QTouchEventWidgetSequence::~QTouchEventWidgetSequence() QTouchEventWidgetSequence& QTouchEventWidgetSequence::press(int touchId, const QPoint &pt, QWidget *widget) { - auto &p = QMutableEventPoint::from(point(touchId)); - p.setGlobalPosition(mapToScreen(widget, pt)); - p.setState(QEventPoint::State::Pressed); + auto &p = point(touchId); + QMutableEventPoint::setGlobalPosition(p, mapToScreen(widget, pt)); + QMutableEventPoint::setState(p, QEventPoint::State::Pressed); return *this; } QTouchEventWidgetSequence& QTouchEventWidgetSequence::move(int touchId, const QPoint &pt, QWidget *widget) { - auto &p = QMutableEventPoint::from(point(touchId)); - p.setGlobalPosition(mapToScreen(widget, pt)); - p.setState(QEventPoint::State::Updated); + auto &p = point(touchId); + QMutableEventPoint::setGlobalPosition(p, mapToScreen(widget, pt)); + QMutableEventPoint::setState(p, QEventPoint::State::Updated); return *this; } QTouchEventWidgetSequence& QTouchEventWidgetSequence::release(int touchId, const QPoint &pt, QWidget *widget) { - auto &p = QMutableEventPoint::from(point(touchId)); - p.setGlobalPosition(mapToScreen(widget, pt)); - p.setState(QEventPoint::State::Released); + auto &p = point(touchId); + QMutableEventPoint::setGlobalPosition(p, mapToScreen(widget, pt)); + QMutableEventPoint::setState(p, QEventPoint::State::Released); return *this; } QTouchEventWidgetSequence& QTouchEventWidgetSequence::stationary(int touchId) { - auto &p = QMutableEventPoint::from(pointOrPreviousPoint(touchId)); - p.setState(QEventPoint::State::Stationary); + auto &p = pointOrPreviousPoint(touchId); + QMutableEventPoint::setState(p, QEventPoint::State::Stationary); return *this; } |