diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-08 09:21:58 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-06-11 22:00:19 +0200 |
commit | 212c2bffbb041aee0e3c9a7f0551ef151ed2d3ad (patch) | |
tree | a9e5265252c2ccfead34d4e42fe8149358bff0f1 /src/quick/items/qquickflickable.cpp | |
parent | 974c8da34d79cd8fc417ff5d69bc00c1e910e5ac (diff) |
Replace calls to deprecated QEvent accessor functions
Several event accessors were deprecated in
qtbase/24e52c10deedbaef833c0e2c3ee7bee03eacc4f5.
Replacements were generated by clazy using the new qevent-accessors check:
$ export CLAZY_CHECKS=qevent-accessors
$ export CLAZY_EXPORT_FIXES=1
$ ../qt6/configure -platform linux-clang -developer-build -debug
-no-optimize-debug -opensource -confirm-license -no-pch QMAKE_CXX=clazy
$ make
$ cd ../../qt6/qtdeclarative
$ find . -name "*.clazy.yaml"
$ clang-apply-replacements .
Task-number: QTBUG-20885
Task-number: QTBUG-84775
Change-Id: I1be5819506fd5039e86b4494223acbe193e6b0c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 979548e737..0d9183315d 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1060,7 +1060,7 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) } q->setKeepMouseGrab(stealMouse); - maybeBeginDrag(computeCurrentTime(event), event->localPos()); + maybeBeginDrag(computeCurrentTime(event), event->position()); } void QQuickFlickablePrivate::maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn) @@ -1318,7 +1318,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) return; qint64 currentTimestamp = computeCurrentTime(event); - QVector2D deltas = QVector2D(event->localPos() - pressPos); + QVector2D deltas = QVector2D(event->position() - pressPos); bool overThreshold = false; QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event); // TODO guarantee that events always have velocity so that it never needs to be computed here @@ -1327,7 +1327,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (currentTimestamp == lastTimestamp) return; // events are too close together: velocity would be infinite qreal elapsed = qreal(currentTimestamp - lastTimestamp) / 1000.; - velocity = QVector2D(event->localPos() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed; + velocity = QVector2D(event->position() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed; } if (q->yflick()) @@ -1335,7 +1335,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (q->xflick()) overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.x(), Qt::XAxis, event); - drag(currentTimestamp, event->type(), event->localPos(), deltas, overThreshold, false, false, velocity); + drag(currentTimestamp, event->type(), event->position(), deltas, overThreshold, false, false, velocity); } void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) @@ -1394,7 +1394,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) bool flickedVertically = false; vVelocity *= flickBoost; - bool isVerticalFlickAllowed = q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->localPos().y() - pressPos.y()) > FlickThreshold; + bool isVerticalFlickAllowed = q->yflick() && qAbs(vVelocity) > MinimumFlickVelocity && qAbs(event->position().y() - pressPos.y()) > FlickThreshold; if (isVerticalFlickAllowed) { velocityTimeline.reset(vData.smoothVelocity); vData.smoothVelocity.setValue(-vVelocity); @@ -1403,7 +1403,7 @@ void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) bool flickedHorizontally = false; hVelocity *= flickBoost; - bool isHorizontalFlickAllowed = q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->localPos().x() - pressPos.x()) > FlickThreshold; + bool isHorizontalFlickAllowed = q->xflick() && qAbs(hVelocity) > MinimumFlickVelocity && qAbs(event->position().x() - pressPos.x()) > FlickThreshold; if (isHorizontalFlickAllowed) { velocityTimeline.reset(hData.smoothVelocity); hData.smoothVelocity.setValue(-hVelocity); @@ -1453,7 +1453,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event) // Now send the release if (window() && window()->mouseGrabberItem()) { - QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->windowPos()); + QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->scenePosition()); QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); QCoreApplication::sendEvent(window(), mouseEvent.data()); } @@ -2383,7 +2383,7 @@ void QQuickFlickablePrivate::addPointerHandler(QQuickPointerHandler *h) bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) { Q_D(QQuickFlickable); - QPointF localPos = mapFromScene(event->windowPos()); + QPointF localPos = mapFromScene(event->scenePosition()); Q_ASSERT_X(receiver != this, "", "Flickable received a filter event for itself"); if (receiver == this && d->stealMouse) { |