diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-03 18:42:09 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-09-05 11:52:48 +0000 |
commit | 2617ac5b9df7dfdecf0cb02d5933c40df1a55bbc (patch) | |
tree | b14cbc0f7335a0397e09014e1953213d086b9ffa /src/quick/handlers | |
parent | be3559470ac934dcfed881996be0eeb1269e6f96 (diff) |
rename QQuickEventPoint pos properties to position
For consistency we always spell it out, although it does make some
of these properties inconveniently verbose.
Change-Id: I64a08c3aa261c0ab89e09472dd47510abafbf7ca
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers')
-rw-r--r-- | src/quick/handlers/qquickdraghandler.cpp | 6 | ||||
-rw-r--r-- | src/quick/handlers/qquickmultipointhandler.cpp | 10 | ||||
-rw-r--r-- | src/quick/handlers/qquickpinchhandler.cpp | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickpointerhandler.cpp | 4 | ||||
-rw-r--r-- | src/quick/handlers/qquicksinglepointhandler.cpp | 14 | ||||
-rw-r--r-- | src/quick/handlers/qquicktaphandler.cpp | 6 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp index 49b391c7d5..840459ba3e 100644 --- a/src/quick/handlers/qquickdraghandler.cpp +++ b/src/quick/handlers/qquickdraghandler.cpp @@ -97,7 +97,7 @@ void QQuickDragHandler::handleEventPoint(QQuickEventPoint *point) setPassiveGrab(point); break; case QQuickEventPoint::Updated: { - QPointF delta = point->scenePos() - point->scenePressPos(); + QPointF delta = point->scenePosition() - point->scenePressPosition(); if (!m_xAxis.enabled()) delta.setX(0); if (!m_yAxis.enabled()) @@ -151,10 +151,10 @@ void QQuickDragHandler::initializeTargetStartPos(QQuickEventPoint *point) { if (target() && target()->parentItem() && m_targetStartPos.isNull()) { // prefer the m_targetStartPos we got when it got Pressed. m_targetStartPos = target()->parentItem()->mapToScene(target()->position()); - if (!target()->contains(point->pos())) { + if (!target()->contains(point->position())) { // If pressed outside of target item, move the target item so that the touchpoint is in its center, // while still respecting the axis constraints. - const QPointF center = target()->parentItem()->mapFromScene(point->scenePos()); + const QPointF center = target()->parentItem()->mapFromScene(point->scenePosition()); const QPointF pointCenteredInItemPos = target()->parentItem()->mapToScene(center - QPointF(target()->width(), target()->height())/2); if (m_xAxis.enabled()) m_targetStartPos.setX(pointCenteredInItemPos.x()); diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp index 66b6fdb4a6..6cc7747e3a 100644 --- a/src/quick/handlers/qquickmultipointhandler.cpp +++ b/src/quick/handlers/qquickmultipointhandler.cpp @@ -93,7 +93,7 @@ QVector<QQuickEventPoint *> QQuickMultiPointHandler::eligiblePoints(QQuickPointe if (exclusiveGrabber && exclusiveGrabber != this) continue; } - if (p->state() != QQuickEventPoint::Released && targetBounds.contains(p->scenePos())) + if (p->state() != QQuickEventPoint::Released && targetBounds.contains(p->scenePosition())) ret << p; } return ret; @@ -146,7 +146,7 @@ QPointF QQuickMultiPointHandler::touchPointCentroid() if (Q_UNLIKELY(m_currentPoints.size() == 0)) return ret; for (QQuickEventPoint *point : qAsConst(m_currentPoints)) - ret += point->scenePos(); + ret += point->scenePosition(); return ret / m_currentPoints.size(); } @@ -166,7 +166,7 @@ qreal QQuickMultiPointHandler::averageTouchPointDistance(const QPointF &ref) if (Q_UNLIKELY(m_currentPoints.size() == 0)) return ret; for (QQuickEventPoint *point : qAsConst(m_currentPoints)) - ret += QVector2D(point->scenePos() - ref).length(); + ret += QVector2D(point->scenePosition() - ref).length(); return ret / m_currentPoints.size(); } @@ -177,7 +177,7 @@ qreal QQuickMultiPointHandler::averageStartingDistance(const QPointF &ref) if (Q_UNLIKELY(m_currentPoints.size() == 0)) return ret; for (QQuickEventPoint *point : qAsConst(m_currentPoints)) - ret += QVector2D(point->sceneGrabPos() - ref).length(); + ret += QVector2D(point->sceneGrabPosition() - ref).length(); return ret / m_currentPoints.size(); } @@ -186,7 +186,7 @@ QVector<QQuickMultiPointHandler::PointData> QQuickMultiPointHandler::angles(cons QVector<PointData> angles; angles.reserve(m_currentPoints.count()); for (QQuickEventPoint *point : qAsConst(m_currentPoints)) { - qreal angle = QLineF(ref, point->scenePos()).angle(); + qreal angle = QLineF(ref, point->scenePosition()).angle(); angles.append(PointData(point->pointId(), -angle)); // convert to clockwise, to be consistent with QQuickItem::rotation } return angles; diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp index 4dd51e744d..92bcc643f3 100644 --- a/src/quick/handlers/qquickpinchhandler.cpp +++ b/src/quick/handlers/qquickpinchhandler.cpp @@ -225,7 +225,7 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event) Q_UNUSED(event) if (Q_UNLIKELY(lcPinchHandler().isDebugEnabled())) { for (QQuickEventPoint *point : qAsConst(m_currentPoints)) - qCDebug(lcPinchHandler) << point->state() << point->sceneGrabPos() << "->" << point->scenePos(); + qCDebug(lcPinchHandler) << point->state() << point->sceneGrabPosition() << "->" << point->scenePosition(); } bool containsReleasedPoints = event->isReleaseEvent(); diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index bcccfac318..14ce8fea03 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -152,14 +152,14 @@ void QQuickPointerHandler::cancelAllGrabs(QQuickEventPoint *point) QPointF QQuickPointerHandler::eventPos(const QQuickEventPoint *point) const { - return (target() ? target()->mapFromScene(point->scenePos()) : point->scenePos()); + return (target() ? target()->mapFromScene(point->scenePosition()) : point->scenePosition()); } bool QQuickPointerHandler::parentContains(const QQuickEventPoint *point) const { if (point) { if (QQuickItem *par = parentItem()) - return par->contains(par->mapFromScene(point->scenePos())); + return par->contains(par->mapFromScene(point->scenePosition())); } return false; } diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp index 8747f5023d..2588c4c180 100644 --- a/src/quick/handlers/qquicksinglepointhandler.cpp +++ b/src/quick/handlers/qquicksinglepointhandler.cpp @@ -135,15 +135,15 @@ void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event) m_pointInfo.m_pressure = event->buttons() ? 1 : 0; m_pointInfo.m_ellipseDiameters = QSizeF(); } - m_pointInfo.m_position = currentPoint->pos(); - m_pointInfo.m_scenePosition = currentPoint->scenePos(); + m_pointInfo.m_position = currentPoint->position(); + m_pointInfo.m_scenePosition = currentPoint->scenePosition(); if (currentPoint->state() == QQuickEventPoint::Updated) m_pointInfo.m_velocity = currentPoint->velocity(); handleEventPoint(currentPoint); switch (currentPoint->state()) { case QQuickEventPoint::Pressed: - m_pointInfo.m_pressPosition = currentPoint->pos(); - m_pointInfo.m_scenePressPosition = currentPoint->scenePos(); + m_pointInfo.m_pressPosition = currentPoint->position(); + m_pointInfo.m_scenePressPosition = currentPoint->scenePosition(); m_pointInfo.m_pressedButtons = event->buttons(); break; case QQuickEventPoint::Released: @@ -169,12 +169,12 @@ void QQuickSinglePointHandler::onGrabChanged(QQuickPointerHandler *grabber, QQui return; switch (stateChange) { case QQuickEventPoint::GrabExclusive: - m_pointInfo.m_sceneGrabPosition = point->sceneGrabPos(); + m_pointInfo.m_sceneGrabPosition = point->sceneGrabPosition(); setActive(true); QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); break; case QQuickEventPoint::GrabPassive: - m_pointInfo.m_sceneGrabPosition = point->sceneGrabPos(); + m_pointInfo.m_sceneGrabPosition = point->sceneGrabPosition(); QQuickPointerHandler::onGrabChanged(grabber, stateChange, point); break; case QQuickEventPoint::OverrideGrabPassive: @@ -199,7 +199,7 @@ void QQuickSinglePointHandler::setIgnoreAdditionalPoints(bool v) void QQuickSinglePointHandler::moveTarget(QPointF pos, QQuickEventPoint *point) { target()->setPosition(pos); - m_pointInfo.m_scenePosition = point->scenePos(); + m_pointInfo.m_scenePosition = point->scenePosition(); m_pointInfo.m_position = target()->mapFromScene(m_pointInfo.m_scenePosition); } diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp index b8d9754cde..f99f84bdb0 100644 --- a/src/quick/handlers/qquicktaphandler.cpp +++ b/src/quick/handlers/qquicktaphandler.cpp @@ -102,7 +102,7 @@ QQuickTapHandler::~QQuickTapHandler() static bool dragOverThreshold(QQuickEventPoint *point) { - QPointF delta = point->scenePos() - point->scenePressPos(); + QPointF delta = point->scenePosition() - point->scenePressPosition(); return (QQuickWindowPrivate::dragOverThreshold(delta.x(), Qt::XAxis, point) || QQuickWindowPrivate::dragOverThreshold(delta.y(), Qt::YAxis, point)); } @@ -280,7 +280,7 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi // Assuming here that pointerEvent()->timestamp() is in ms. qreal ts = point->pointerEvent()->timestamp() / 1000.0; if (ts - m_lastTapTimestamp < m_multiTapInterval && - QVector2D(point->scenePos() - m_lastTapPos).lengthSquared() < + QVector2D(point->scenePosition() - m_lastTapPos).lengthSquared() < (point->pointerEvent()->device()->type() == QQuickPointerDevice::Mouse ? m_mouseMultiClickDistanceSquared : m_touchMultiTapDistanceSquared)) ++m_tapCount; @@ -290,7 +290,7 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi emit tapped(); emit tapCountChanged(); m_lastTapTimestamp = ts; - m_lastTapPos = point->scenePos(); + m_lastTapPos = point->scenePosition(); } else { qCDebug(lcTapHandler) << objectName() << "tap threshold" << longPressThreshold() << "exceeded:" << point->timeHeld(); } |