From 55f6a109e99ea2eb3359fa941a1826d4b4e11bf8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 22 Oct 2012 16:59:25 +0200 Subject: [PATCH] Renamed QQuickItem::pos property to position MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Abbreviated property names are less descriptive so we don't have many of them. Might as well be consistent. QWindow::pos was already renamed. Change-Id: Ib52673e68e7dc902b2f8942dba6b899074b2538b Reviewed-by: Samuel Rødal --- .../qmltooling/qmldbg_qtquick2/highlight.cpp | 4 +- .../qmltooling/qmldbg_qtquick2/inspecttool.cpp | 16 ++++---- src/quick/items/qquickanchors.cpp | 2 +- src/quick/items/qquickgridview.cpp | 6 +-- src/quick/items/qquickitem.cpp | 6 +-- src/quick/items/qquickitem.h | 5 +-- src/quick/items/qquickitemanimation.cpp | 4 +- src/quick/items/qquickitemview.cpp | 2 +- src/quick/items/qquickitemviewtransition.cpp | 8 ++-- src/quick/items/qquickmousearea.cpp | 8 ++-- src/quick/items/qquickpincharea.cpp | 2 +- src/quick/items/qquickpositioners.cpp | 2 +- src/quick/items/qquickstateoperations.cpp | 2 +- src/quick/items/qquicktextinput.cpp | 2 +- src/quick/items/qquicktextutil.cpp | 2 +- .../qquickanimations/tst_qquickanimations.cpp | 2 +- tests/auto/quick/qquickdrag/tst_qquickdrag.cpp | 30 +++++++------- .../quick/qquickdroparea/tst_qquickdroparea.cpp | 10 ++--- .../quick/qquickgridview/tst_qquickgridview.cpp | 44 ++++++++++----------- tests/auto/quick/qquickitem/tst_qquickitem.cpp | 2 +- .../quick/qquicklistview/tst_qquicklistview.cpp | 36 ++++++++--------- .../quick/qquickmousearea/tst_qquickmousearea.cpp | 2 +- .../quick/qquickpathview/tst_qquickpathview.cpp | 46 +++++++++++----------- .../quick/qquicktextedit/tst_qquicktextedit.cpp | 8 ++-- .../quick/qquicktextinput/tst_qquicktextinput.cpp | 14 +++---- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 28 ++++++------- tests/auto/quick/touchmouse/tst_touchmouse.cpp | 12 +++--- 27 files changed, 152 insertions(+), 153 deletions(-) diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp index d6fc0b2..b859874 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp @@ -113,13 +113,13 @@ void Highlight::adjust() QQuickWindow *view = m_item->window(); if (view->contentItem()) { scaleFactor = view->contentItem()->scale(); - originOffset -= view->contentItem()->pos(); + originOffset -= view->contentItem()->position(); } // The scale transform for the overlay needs to be cancelled // as the Item's transform which will be applied to the painter // takes care of it. parentItem()->setScale(1/scaleFactor); - setPos(originOffset); + setPosition(originOffset); update(); } diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp index 8cd40b4..d05f4b9 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp @@ -67,7 +67,7 @@ InspectTool::InspectTool(QQuickViewInspector *inspector, QQuickView *view) : m_didPressAndHold(false), m_tapEvent(false), m_contentItem(view->contentItem()), - m_originalPosition(view->contentItem()->pos()), + m_originalPosition(view->contentItem()->position()), m_smoothScaleFactor(Constants::ZoomSnapDelta), m_minScale(0.125f), m_maxScale(48.0f), @@ -100,14 +100,14 @@ void InspectTool::enable(bool enable) // restoring the original states. if (m_contentItem) { m_contentItem->setScale(m_originalScale); - m_contentItem->setPos(m_originalPosition); + m_contentItem->setPosition(m_originalPosition); m_contentItem->setSmooth(m_originalSmooth); } } else { if (m_contentItem) { m_originalSmooth = m_contentItem->smooth(); m_originalScale = m_contentItem->scale(); - m_originalPosition = m_contentItem->pos(); + m_originalPosition = m_contentItem->position(); m_contentItem->setSmooth(true); } } @@ -288,9 +288,9 @@ void InspectTool::scaleView(const qreal &factor, const QPointF &newcenter, const return; } //New position = new center + scalefactor * (oldposition - oldcenter) - QPointF newPosition = newcenter + (factor * (m_contentItem->pos() - oldcenter)); + QPointF newPosition = newcenter + (factor * (m_contentItem->position() - oldcenter)); m_contentItem->setScale(m_contentItem->scale() * factor); - m_contentItem->setPos(newPosition); + m_contentItem->setPosition(newPosition); } void InspectTool::zoomIn() @@ -309,7 +309,7 @@ void InspectTool::zoomTo100() { m_didPressAndHold = true; - m_contentItem->setPos(QPointF(0, 0)); + m_contentItem->setPosition(QPointF(0, 0)); m_contentItem->setScale(1.0); } @@ -361,9 +361,9 @@ void InspectTool::initializeDrag(const QPointF &pos) void InspectTool::dragItemToPosition() { - QPointF newPosition = m_contentItem->pos() + m_mousePosition - m_dragStartPosition; + QPointF newPosition = m_contentItem->position() + m_mousePosition - m_dragStartPosition; m_dragStartPosition = m_mousePosition; - m_contentItem->setPos(newPosition); + m_contentItem->setPosition(newPosition); } void InspectTool::moveItem(bool valid) diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp index 8be2d39..f264680 100644 --- a/src/quick/items/qquickanchors.cpp +++ b/src/quick/items/qquickanchors.cpp @@ -398,7 +398,7 @@ void QQuickAnchorsPrivate::setItemY(qreal v) void QQuickAnchorsPrivate::setItemPos(const QPointF &v) { updatingMe = true; - item->setPos(v); + item->setPosition(v); updatingMe = false; } diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 3ef8c1d..2d9c95e 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -684,7 +684,7 @@ void QQuickGridViewPrivate::repositionPackageItemAt(QQuickItem *item, int index) qreal y = (verticalLayoutDirection == QQuickItemView::TopToBottom) ? rowPosAt(index) : -rowPosAt(index) - item->height(); - item->setPos(QPointF(colPosAt(index), y)); + item->setPosition(QPointF(colPosAt(index), y)); } } else { if (item->x() + item->width() > pos && item->x() < pos + q->width()) { @@ -692,9 +692,9 @@ void QQuickGridViewPrivate::repositionPackageItemAt(QQuickItem *item, int index) ? colPosAt(index) : -colPosAt(index) - item->height(); if (flow == QQuickGridView::FlowTopToBottom && q->effectiveLayoutDirection() == Qt::RightToLeft) - item->setPos(QPointF(-rowPosAt(index)-item->width(), y)); + item->setPosition(QPointF(-rowPosAt(index)-item->width(), y)); else - item->setPos(QPointF(rowPosAt(index), y)); + item->setPosition(QPointF(rowPosAt(index), y)); } } } diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 9180eb4..e557ce4 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5319,7 +5319,7 @@ qreal QQuickItem::y() const /*! \internal */ -QPointF QQuickItem::pos() const +QPointF QQuickItem::position() const { Q_D(const QQuickItem); return QPointF(d->x, d->y); @@ -5358,7 +5358,7 @@ void QQuickItem::setY(qreal v) /*! \internal */ -void QQuickItem::setPos(const QPointF &pos) +void QQuickItem::setPosition(const QPointF &pos) { Q_D(QQuickItem); if (QPointF(d->x, d->y) == pos) @@ -6554,7 +6554,7 @@ QDebug operator<<(QDebug debug, QQuickItem *item) debug << item->metaObject()->className() << "(this =" << ((void*)item) << ", name=" << item->objectName() << ", parent =" << ((void*)item->parentItem()) - << ", geometry =" << QRectF(item->pos(), QSizeF(item->width(), item->height())) + << ", geometry =" << QRectF(item->position(), QSizeF(item->width(), item->height())) << ", z =" << item->z() << ')'; return debug; } diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index a41aa7f..bba26be 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -105,7 +105,6 @@ class Q_QUICK_EXPORT QQuickItem : public QObject, public QQmlParserStatus Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty resources READ resources DESIGNABLE false) Q_PRIVATE_PROPERTY(QQuickItem::d_func(), QQmlListProperty children READ children NOTIFY childrenChanged DESIGNABLE false) - Q_PROPERTY(QPointF pos READ pos FINAL) Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) Q_PROPERTY(qreal z READ z WRITE setZ NOTIFY zChanged FINAL) @@ -220,10 +219,10 @@ public: qreal x() const; qreal y() const; - QPointF pos() const; + QPointF position() const; void setX(qreal); void setY(qreal); - void setPos(const QPointF &); + void setPosition(const QPointF &); qreal width() const; void setWidth(qreal); diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index ef2248d..769f17f 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -899,7 +899,7 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio QPointF pathPos = QQuickPath::sequentialPointAt(prevData.painterPath, prevData.pathLength, prevData.attributePoints, prevData.prevBez, prevData.currentV); if (!prevData.anchorPoint.isNull()) pathPos -= prevData.anchorPoint; - if (pathPos == data->target->pos()) { //only treat as interruption if we interrupted ourself + if (pathPos == data->target->position()) { //only treat as interruption if we interrupted ourself data->painterPath = prevData.painterPath; data->toDefined = data->fromDefined = data->fromSourced = true; data->prevBez.isValid = false; @@ -961,7 +961,7 @@ void QQuickPathAnimationUpdater::setValue(qreal v) } } - target->setPos(currentPos); + target->setPosition(currentPos); //adjust angle according to orientation if (!fixed) { diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 8cb22dc..1ac8fcd 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -85,7 +85,7 @@ void FxViewItem::moveTo(const QPointF &pos, bool immediate) if (transitionableItem) transitionableItem->moveTo(pos, immediate); else - item->setPos(pos); + item->setPosition(pos); } void FxViewItem::setVisible(bool visible) diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 18953cf..029446a 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -368,7 +368,7 @@ qreal QQuickItemViewTransitionableItem::itemY() const void QQuickItemViewTransitionableItem::moveTo(const QPointF &pos, bool immediate) { if (!nextTransitionFromSet && nextTransitionType != QQuickItemViewTransitioner::NoTransition) { - nextTransitionFrom = item->pos(); + nextTransitionFrom = item->position(); nextTransitionFromSet = true; } @@ -378,7 +378,7 @@ void QQuickItemViewTransitionableItem::moveTo(const QPointF &pos, bool immediate if (immediate || !transitionScheduledOrRunning()) { if (immediate) stopTransition(); - item->setPos(pos); + item->setPosition(pos); } else { nextTransitionTo = pos; nextTransitionToSet = true; @@ -415,7 +415,7 @@ bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitio // This ensures that removed targets don't transition to the default (0,0) and that // items set for other transition types only transition if they actually move somewhere. if (!nextTransitionToSet) - moveTo(item->pos()); + moveTo(item->position()); } else { // don't start displaced transitions that don't move anywhere if (!nextTransitionToSet || (nextTransitionFromSet && nextTransitionFrom == nextTransitionTo)) { @@ -480,7 +480,7 @@ bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitio if (!doTransition) { // if transition type is not valid, the previous transition still has to be // canceled so that the item can move immediately to the right position - item->setPos(nextTransitionTo); + item->setPosition(nextTransitionTo); stopTransition(); } diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 803840a..ad3f4fa 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -783,8 +783,8 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) if (d->drag && d->drag->target()) { if (!d->moved) { d->targetStartPos = d->drag->target()->parentItem() - ? d->drag->target()->parentItem()->mapToScene(d->drag->target()->pos()) - : d->drag->target()->pos(); + ? d->drag->target()->parentItem()->mapToScene(d->drag->target()->position()) + : d->drag->target()->position(); } QPointF startLocalPos; @@ -807,7 +807,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) ? d->drag->target()->parentItem()->mapFromScene(d->targetStartPos) : d->targetStartPos; - QPointF dragPos = d->drag->target()->pos(); + QPointF dragPos = d->drag->target()->position(); bool dragX = drag()->axis() & QQuickDrag::XAxis; bool dragY = drag()->axis() & QQuickDrag::YAxis; @@ -828,7 +828,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) y = drag()->ymax(); dragPos.setY(y); } - d->drag->target()->setPos(dragPos); + d->drag->target()->setPosition(dragPos); if (!keepMouseGrab()) { bool xDragged = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 2bf9016..5dcea62 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -423,7 +423,7 @@ void QQuickPinchArea::updatePinch() grabMouse(); setKeepMouseGrab(true); if (d->pinch && d->pinch->target()) { - d->pinchStartPos = pinch()->target()->pos(); + d->pinchStartPos = pinch()->target()->position(); d->pinchStartScale = d->pinch->target()->scale(); d->pinchStartRotation = d->pinch->target()->rotation(); d->pinch->setActive(true); diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index a253bcc..b9db330 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -102,7 +102,7 @@ void QQuickBasePositioner::PositionedItem::moveTo(const QPointF &pos) if (transitionableItem) transitionableItem->moveTo(pos); else - item->setPos(pos); + item->setPosition(pos); } void QQuickBasePositioner::PositionedItem::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget) diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index c30b0ee..50ab907 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -132,7 +132,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s if (ok) { //qDebug() << x << y << rotation << scale; - target->setPos(QPointF(x, y)); + target->setPosition(QPointF(x, y)); target->setRotation(target->rotation() + rotation); target->setScale(target->scale() * scale); } diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 8cee9eb..fee4959 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2575,7 +2575,7 @@ void QQuickTextInput::updateCursorRectangle() emit cursorRectangleChanged(); if (d->cursorItem) { QRectF r = cursorRectangle(); - d->cursorItem->setPos(r.topLeft()); + d->cursorItem->setPosition(r.topLeft()); d->cursorItem->setHeight(r.height()); } #ifndef QT_NO_IM diff --git a/src/quick/items/qquicktextutil.cpp b/src/quick/items/qquicktextutil.cpp index d393142..40287a7 100644 --- a/src/quick/items/qquicktextutil.cpp +++ b/src/quick/items/qquicktextutil.cpp @@ -60,7 +60,7 @@ QQuickItem *QQuickTextUtil::createCursor( if ((item = qobject_cast(object))) { QQml_setParent_noEvent(item, parent); item->setParentItem(parent); - item->setPos(rectangle.topLeft()); + item->setPosition(rectangle.topLeft()); item->setHeight(rectangle.height()); } else { qmlInfo(parent) << tr("%1 does not support loading non-visual cursor delegates.") diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 37b036c..81b1255 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -136,7 +136,7 @@ void tst_qquickanimations::simpleProperty() QTest::qWait(animation.duration()); QTIMED_COMPARE(rect.x(), 200.0); - rect.setPos(QPointF(0,0)); + rect.setPosition(QPointF(0,0)); animation.start(); QVERIFY(animation.isRunning()); animation.pause(); diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index 562863b..2159368 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -372,7 +372,7 @@ void tst_QQuickDrag::active() QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0); dropTarget.reset(); - item->setPos(QPointF(80, 80)); + item->setPosition(QPointF(80, 80)); QCOMPARE(evaluate(item, "Drag.active"), true); QCOMPARE(evaluate(item, "dragActive"), true); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0); @@ -508,7 +508,7 @@ void tst_QQuickDrag::drop() // Queued move event is delivered before a drop event. innerTarget.reset(); outerTarget.reset(); evaluate(item, "Drag.active = true"); - item->setPos(QPointF(80, 80)); + item->setPosition(QPointF(80, 80)); evaluate(item, "Drag.drop()"); QCOMPARE(evaluate(item, "Drag.active"), false); QCOMPARE(evaluate(item, "dragActive"), false); @@ -529,10 +529,10 @@ void tst_QQuickDrag::move() TestDropTarget outerTarget(window.contentItem()); outerTarget.setSize(QSizeF(100, 100)); TestDropTarget leftTarget(&outerTarget); - leftTarget.setPos(QPointF(0, 35)); + leftTarget.setPosition(QPointF(0, 35)); leftTarget.setSize(QSizeF(30, 30)); TestDropTarget rightTarget(&outerTarget); - rightTarget.setPos(QPointF(70, 35)); + rightTarget.setPosition(QPointF(70, 35)); rightTarget.setSize(QSizeF(30, 30)); QQmlComponent component(&engine); component.setData( @@ -560,7 +560,7 @@ void tst_QQuickDrag::move() // Move within the outer target. outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(60, 50)); + item->setPosition(QPointF(60, 50)); // Move event is delivered in the event loop. QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.moveEvents, 0); QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 0); QCOMPARE(leftTarget .moveEvents, 0); @@ -592,7 +592,7 @@ void tst_QQuickDrag::move() // Move into the left target. outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(25, 50)); + item->setPosition(QPointF(25, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&leftTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&leftTarget)); @@ -604,7 +604,7 @@ void tst_QQuickDrag::move() // Move within the left target. outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(25, 40)); + item->setPosition(QPointF(25, 40)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&leftTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&leftTarget)); @@ -616,7 +616,7 @@ void tst_QQuickDrag::move() // Move out of all targets. outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(110, 50)); + item->setPosition(QPointF(110, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(0)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(0)); @@ -628,7 +628,7 @@ void tst_QQuickDrag::move() rightTarget.accept = false; outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(80, 50)); + item->setPosition(QPointF(80, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&outerTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&outerTarget)); @@ -641,7 +641,7 @@ void tst_QQuickDrag::move() outerTarget.accept = false; outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(60, 50)); + item->setPosition(QPointF(60, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&outerTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&outerTarget)); @@ -654,7 +654,7 @@ void tst_QQuickDrag::move() outerTarget.setFlags(QQuickItem::Flags()); outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(40, 50)); + item->setPosition(QPointF(40, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&outerTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&outerTarget)); @@ -667,7 +667,7 @@ void tst_QQuickDrag::move() leftTarget.setFlags(QQuickItem::Flags()); outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); - item->setPos(QPointF(25, 50)); + item->setPosition(QPointF(25, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(item, "Drag.target"), static_cast(&outerTarget)); QCOMPARE(evaluate(item, "dragTarget"), static_cast(&outerTarget)); @@ -802,7 +802,7 @@ void tst_QQuickDrag::hotSpot() QCOMPARE(dropTarget.position.x(), qreal(55)); QCOMPARE(dropTarget.position.y(), qreal(55)); - item->setPos(QPointF(30, 20)); + item->setPosition(QPointF(30, 20)); QCoreApplication::processEvents(); QCOMPARE(dropTarget.position.x(), qreal(35)); QCOMPARE(dropTarget.position.y(), qreal(25)); @@ -820,7 +820,7 @@ void tst_QQuickDrag::hotSpot() QCOMPARE(dropTarget.position.x(), qreal(40)); QCOMPARE(dropTarget.position.y(), qreal(30)); - item->setPos(QPointF(10, 20)); + item->setPosition(QPointF(10, 20)); QCoreApplication::processEvents(); QCOMPARE(dropTarget.position.x(), qreal(20)); QCOMPARE(dropTarget.position.y(), qreal(30)); @@ -865,7 +865,7 @@ void tst_QQuickDrag::supportedActions() evaluate(item, "Drag.supportedActions = Qt.MoveAction"); QCOMPARE(evaluate(item, "Drag.supportedActions == Qt.MoveAction"), true); QCOMPARE(evaluate(item, "supportedActions == Qt.MoveAction"), true); - item->setPos(QPointF(60, 60)); + item->setPosition(QPointF(60, 60)); QCOMPARE(dropTarget.supportedActions, Qt::CopyAction | Qt::MoveAction); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.enterEvents, 1); diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp index 927a57b..ef804a9 100644 --- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp @@ -145,14 +145,14 @@ void tst_QQuickDropArea::containsDrag_internal() evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - dragItem->setPos(QPointF(150, 50)); + dragItem->setPosition(QPointF(150, 50)); evaluate(dragItem, "Drag.active = true"); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "exitEvents"), 0); - dragItem->setPos(QPointF(50, 50)); + dragItem->setPosition(QPointF(50, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "hasDrag"), true); @@ -160,7 +160,7 @@ void tst_QQuickDropArea::containsDrag_internal() QCOMPARE(evaluate(dropArea, "exitEvents"), 0); evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - dragItem->setPos(QPointF(150, 50)); + dragItem->setPosition(QPointF(150, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(dropArea, "containsDrag"), false); @@ -544,7 +544,7 @@ void tst_QQuickDropArea::position_internal() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - dragItem->setPos(QPointF(40, 50)); + dragItem->setPosition(QPointF(40, 50)); QCoreApplication::processEvents(); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); @@ -556,7 +556,7 @@ void tst_QQuickDropArea::position_internal() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - dragItem->setPos(QPointF(75, 25)); + dragItem->setPosition(QPointF(75, 25)); QCoreApplication::processEvents(); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index cdb17b3..37d96f4 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -542,7 +542,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, firstPos.rx() = flow == QQuickGridView::FlowLeftToRight ? gridview->width() - gridview->cellWidth() : -gridview->cellWidth(); if (verticalLayout == QQuickItemView::BottomToTop) firstPos.ry() -= gridview->cellHeight(); - QCOMPARE(item0->pos(), firstPos); + QCOMPARE(item0->position(), firstPos); QList items = findItems(contentItem, "wrapper"); int firstVisibleIndex = -1; @@ -559,7 +559,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { QQuickItem *item = findItem(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); - QCOMPARE(item->pos(), expectedItemPos(gridview, i, rowOffsetAfterMove)); + QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem(contentItem, "textName", i); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(i)); @@ -983,7 +983,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, for (int i = firstVisibleIndex; i < model.count() && i < items.count(); ++i) { QQuickItem *item = findItem(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); - QCOMPARE(item->pos(), expectedItemPos(gridview, i, rowOffsetAfterMove)); + QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem(contentItem, "textName", i); QVERIFY(name != 0); QTRY_COMPARE(name->text(), model.name(i)); @@ -1329,7 +1329,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, continue; // index has moved out of view } QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); - QCOMPARE(item->pos(), expectedItemPos(gridview, i, rowOffsetAfterMove)); + QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem(contentItem, "textName", i); QVERIFY(name != 0); QTRY_COMPARE(name->text(), model.name(i)); @@ -3013,7 +3013,7 @@ void tst_QQuickGridView::footer() QVERIFY(footer); QVERIFY(footer == gridview->footerItem()); - QCOMPARE(footer->pos(), initialFooterPos); + QCOMPARE(footer->position(), initialFooterPos); QCOMPARE(footer->width(), 100.); QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); @@ -3025,7 +3025,7 @@ void tst_QQuickGridView::footer() QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); if (flow == QQuickGridView::FlowLeftToRight) { // shrink by one row @@ -3056,12 +3056,12 @@ void tst_QQuickGridView::footer() posWhenNoItems.setX(flow == QQuickGridView::FlowLeftToRight ? gridview->width() - footer->width() : -footer->width()); if (verticalLayoutDirection == QQuickItemView::BottomToTop) posWhenNoItems.setY(-footer->height()); - QTRY_COMPARE(footer->pos(), posWhenNoItems); + QTRY_COMPARE(footer->position(), posWhenNoItems); // if header is toggled, it shouldn't affect the footer position window->rootObject()->setProperty("showHeader", true); QVERIFY(findItem(contentItem, "header") != 0); - QTRY_COMPARE(footer->pos(), posWhenNoItems); + QTRY_COMPARE(footer->position(), posWhenNoItems); window->rootObject()->setProperty("showHeader", false); // add 30 items @@ -3079,7 +3079,7 @@ void tst_QQuickGridView::footer() QVERIFY(footer); QVERIFY(footer == gridview->footerItem()); - QCOMPARE(footer->pos(), changedFooterPos); + QCOMPARE(footer->position(), changedFooterPos); QCOMPARE(footer->width(), 50.); QCOMPARE(footer->height(), 20.); @@ -3088,7 +3088,7 @@ void tst_QQuickGridView::footer() item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); gridview->positionViewAtEnd(); footer->setHeight(10); @@ -3247,7 +3247,7 @@ void tst_QQuickGridView::header() QVERIFY(header); QVERIFY(header == gridview->headerItem()); - QCOMPARE(header->pos(), initialHeaderPos); + QCOMPARE(header->position(), initialHeaderPos); QCOMPARE(header->width(), 100.); QCOMPARE(header->height(), 30.); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); @@ -3259,11 +3259,11 @@ void tst_QQuickGridView::header() QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); model.clear(); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); - QCOMPARE(header->pos(), initialHeaderPos); // header should stay where it is + QCOMPARE(header->position(), initialHeaderPos); // header should stay where it is if (flow == QQuickGridView::FlowLeftToRight) QCOMPARE(gridview->contentHeight(), header->height()); else @@ -3284,14 +3284,14 @@ void tst_QQuickGridView::header() QVERIFY(header == gridview->headerItem()); - QCOMPARE(header->pos(), changedHeaderPos); + QCOMPARE(header->position(), changedHeaderPos); QCOMPARE(header->width(), 50.); QCOMPARE(header->height(), 20.); QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), changedContentPos); item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); header->setHeight(10); header->setWidth(40); @@ -3319,7 +3319,7 @@ void tst_QQuickGridView::header() gridview->setWidth(240); gridview->setHeight(320); - QTRY_COMPARE(gridview->headerItem()->pos(), initialHeaderPos); + QTRY_COMPARE(gridview->headerItem()->position(), initialHeaderPos); QCOMPARE(QPointF(gridview->contentX(), gridview->contentY()), initialContentPos); releaseView(window); @@ -3467,11 +3467,11 @@ void tst_QQuickGridView::extents() QQuickItem *header = findItem(contentItem, "header"); QVERIFY(header); - QCOMPARE(header->pos(), headerPos); + QCOMPARE(header->position(), headerPos); QQuickItem *footer = findItem(contentItem, "footer"); QVERIFY(footer); - QCOMPARE(footer->pos(), footerPos); + QCOMPARE(footer->position(), footerPos); QCOMPARE(static_cast(gridview)->minX(), minPos.x()); QCOMPARE(static_cast(gridview)->minY(), minPos.y()); @@ -3706,7 +3706,7 @@ void tst_QQuickGridView::resizeGrid() QQuickItem *item0 = findItem(contentItem, "wrapper", 0); QVERIFY(item0); - QCOMPARE(item0->pos(), firstItemPos); + QCOMPARE(item0->position(), firstItemPos); // Confirm items positioned correctly and indexes correct QList items = findItems(contentItem, "wrapper"); @@ -3714,7 +3714,7 @@ void tst_QQuickGridView::resizeGrid() for (int i = 0; i < model.count() && i < items.count(); ++i) { QQuickItem *item = findItem(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); - QCOMPARE(item->pos(), expectedItemPos(gridview, i, 0)); + QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem(contentItem, "textName", i); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(i)); @@ -3730,7 +3730,7 @@ void tst_QQuickGridView::resizeGrid() QCOMPARE(findItem(contentItem, "wrapper", 0), item0); if (flow == QQuickGridView::FlowLeftToRight && layoutDirection == Qt::RightToLeft) firstItemPos.rx() += 80; - QCOMPARE(item0->pos(), firstItemPos); + QCOMPARE(item0->position(), firstItemPos); QPointF newContentPos = initialContentPos; if (flow == QQuickGridView::FlowTopToBottom && layoutDirection == Qt::RightToLeft) @@ -3746,7 +3746,7 @@ void tst_QQuickGridView::resizeGrid() for (int i = 0; i < model.count() && i < items.count(); ++i) { QQuickItem *item = findItem(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); - QCOMPARE(item->pos(), expectedItemPos(gridview, i, 0)); + QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem(contentItem, "textName", i); QVERIFY(name != 0); QCOMPARE(name->text(), model.name(i)); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index 0cdf95c..6209f41 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1519,7 +1519,7 @@ void tst_qquickitem::hoverEventInParent() HoverItem *rightItem = new HoverItem(parentItem); rightItem->setSize(QSizeF(100, 200)); - rightItem->setPos(QPointF(100, 0)); + rightItem->setPosition(QPointF(100, 0)); rightItem->setAcceptHoverEvents(true); const QPoint insideLeft(50, 100); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 3bb4998..af628df 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -3463,7 +3463,7 @@ void tst_QQuickListView::header() QCOMPARE(header->width(), 100.); QCOMPARE(header->height(), 30.); - QCOMPARE(header->pos(), initialHeaderPos); + QCOMPARE(header->position(), initialHeaderPos); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); if (orientation == QQuickListView::Vertical) @@ -3473,11 +3473,11 @@ void tst_QQuickListView::header() QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); model.clear(); QTRY_COMPARE(listview->count(), model.count()); - QCOMPARE(header->pos(), initialHeaderPos); // header should stay where it is + QCOMPARE(header->position(), initialHeaderPos); // header should stay where it is if (orientation == QQuickListView::Vertical) QCOMPARE(listview->contentHeight(), header->height()); else @@ -3498,14 +3498,14 @@ void tst_QQuickListView::header() QVERIFY(header == listview->headerItem()); - QCOMPARE(header->pos(), changedHeaderPos); + QCOMPARE(header->position(), changedHeaderPos); QCOMPARE(header->width(), 50.); QCOMPARE(header->height(), 20.); QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), changedContentPos); item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); listview->positionViewAtBeginning(); header->setHeight(10); @@ -3534,7 +3534,7 @@ void tst_QQuickListView::header() listview->setWidth(240); listview->setHeight(320); - QTRY_COMPARE(listview->headerItem()->pos(), initialHeaderPos); + QTRY_COMPARE(listview->headerItem()->position(), initialHeaderPos); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); releaseView(window); @@ -3671,7 +3671,7 @@ void tst_QQuickListView::footer() QVERIFY(footer == listview->footerItem()); - QCOMPARE(footer->pos(), initialFooterPos); + QCOMPARE(footer->position(), initialFooterPos); QCOMPARE(footer->width(), 100.); QCOMPARE(footer->height(), 30.); QCOMPARE(QPointF(listview->contentX(), listview->contentY()), initialContentPos); @@ -3683,7 +3683,7 @@ void tst_QQuickListView::footer() QQuickItem *item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); // remove one item model.removeItem(1); @@ -3708,11 +3708,11 @@ void tst_QQuickListView::footer() posWhenNoItems.setX(-100); else if (orientation == QQuickListView::Vertical && verticalLayoutDirection == QQuickItemView::BottomToTop) posWhenNoItems.setY(-30); - QTRY_COMPARE(footer->pos(), posWhenNoItems); + QTRY_COMPARE(footer->position(), posWhenNoItems); // if header is present, it's at a negative pos, so the footer should not move window->rootObject()->setProperty("showHeader", true); - QTRY_COMPARE(footer->pos(), posWhenNoItems); + QTRY_COMPARE(footer->position(), posWhenNoItems); window->rootObject()->setProperty("showHeader", false); // add 30 items @@ -3731,14 +3731,14 @@ void tst_QQuickListView::footer() QVERIFY(footer == listview->footerItem()); - QCOMPARE(footer->pos(), changedFooterPos); + QCOMPARE(footer->position(), changedFooterPos); QCOMPARE(footer->width(), 50.); QCOMPARE(footer->height(), 20.); QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), changedContentPos); item = findItem(contentItem, "wrapper", 0); QVERIFY(item); - QCOMPARE(item->pos(), firstDelegatePos); + QCOMPARE(item->position(), firstDelegatePos); listview->positionViewAtEnd(); footer->setHeight(10); @@ -3856,11 +3856,11 @@ void tst_QQuickListView::extents() QQuickItem *header = findItem(contentItem, "header"); QVERIFY(header); - QCOMPARE(header->pos(), headerPos); + QCOMPARE(header->position(), headerPos); QQuickItem *footer = findItem(contentItem, "footer"); QVERIFY(footer); - QCOMPARE(footer->pos(), footerPos); + QCOMPARE(footer->position(), footerPos); QCOMPARE(static_cast(listview)->minX(), minPos.x()); QCOMPARE(static_cast(listview)->minY(), minPos.y()); @@ -4313,7 +4313,7 @@ void tst_QQuickListView::repositionResizedDelegate() QQuickItem *positioner = findItem(window->rootObject(), "positioner"); QVERIFY(positioner); QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size()); - QTRY_COMPARE(positioner->pos(), origPositionerRect.topLeft()); + QTRY_COMPARE(positioner->position(), origPositionerRect.topLeft()); QSignalSpy spy(listview, orientation == QQuickListView::Vertical ? SIGNAL(contentYChanged()) : SIGNAL(contentXChanged())); int prevSpyCount = 0; @@ -4327,14 +4327,14 @@ void tst_QQuickListView::repositionResizedDelegate() prevSpyCount = spy.count(); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size()); - QTRY_COMPARE(positioner->pos(), resizedPositionerRect.topLeft()); + QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft()); QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y()); QCOMPARE(spy.count(), prevSpyCount); QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "decrementRepeater")); QTRY_COMPARE(positioner->boundingRect().size(), origPositionerRect.size()); - QTRY_COMPARE(positioner->pos(), origPositionerRect.topLeft()); + QTRY_COMPARE(positioner->position(), origPositionerRect.topLeft()); QCOMPARE(listview->contentX(), contentPos_itemFirstHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemFirstHalfVisible.y()); @@ -4346,7 +4346,7 @@ void tst_QQuickListView::repositionResizedDelegate() QVERIFY(QMetaObject::invokeMethod(window->rootObject(), "incrementRepeater")); positioner = findItem(window->rootObject(), "positioner"); QTRY_COMPARE(positioner->boundingRect().size(), resizedPositionerRect.size()); - QTRY_COMPARE(positioner->pos(), resizedPositionerRect.topLeft()); + QTRY_COMPARE(positioner->position(), resizedPositionerRect.topLeft()); QCOMPARE(listview->contentX(), contentPos_itemSecondHalfVisible.x()); QCOMPARE(listview->contentY(), contentPos_itemSecondHalfVisible.y()); qApp->processEvents(); diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index a4e93d5..3c89ad4 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -450,7 +450,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize() QCOMPARE(mouseRegion->mouseX(), 0.0); QCOMPARE(mouseRegion->mouseY(), 0.0); - QMouseEvent event(QEvent::MouseButtonPress, rect->pos().toPoint(), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(window, &event); QVERIFY(!mouseRegion->property("emitPositionChanged").toBool()); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index f36849a..dc0f31d 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -236,7 +236,7 @@ void tst_QQuickPathView::items() QPointF offset; offset.setX(pathview->highlightItem()->width()/2); offset.setY(pathview->highlightItem()->height()/2); - QCOMPARE(pathview->highlightItem()->pos() + offset, start); + QCOMPARE(pathview->highlightItem()->position() + offset, start); delete window; } @@ -896,19 +896,19 @@ void tst_QQuickPathView::pathMoved() QPointF offset;//Center of item is at point, but pos is from corner offset.setX(firstItem->width()/2); offset.setY(firstItem->height()/2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); pathview->setOffset(1.0); for (int i=0; i(pathview, "wrapper", i); QPointF itemPos(path->pointAt(0.25 + i*0.25)); - QCOMPARE(curItem->pos() + offset, QPointF(itemPos.x(), itemPos.y())); + QCOMPARE(curItem->position() + offset, QPointF(itemPos.x(), itemPos.y())); } QCOMPARE(pathview->currentIndex(), 3); pathview->setOffset(0.0); - QCOMPARE(firstItem->pos() + offset, start); + QCOMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentIndex(), 0); // Change delegate size @@ -917,13 +917,13 @@ void tst_QQuickPathView::pathMoved() window->rootObject()->setProperty("delegateWidth", 30); QCOMPARE(firstItem->width(), 30.0); offset.setX(firstItem->width()/2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); // Change delegate scale pathview->setOffset(0.1); pathview->setOffset(0.0); window->rootObject()->setProperty("delegateScale", 1.2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); delete window; } @@ -985,14 +985,14 @@ void tst_QQuickPathView::setCurrentIndex() QPointF offset;//Center of item is at point, but pos is from corner offset.setX(firstItem->width()/2); offset.setY(firstItem->height()/2); - QCOMPARE(firstItem->pos() + offset, start); + QCOMPARE(firstItem->position() + offset, start); QCOMPARE(window->rootObject()->property("currentA").toInt(), 0); QCOMPARE(window->rootObject()->property("currentB").toInt(), 0); pathview->setCurrentIndex(2); firstItem = findItem(pathview, "wrapper", 2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(window->rootObject()->property("currentA").toInt(), 2); QCOMPARE(window->rootObject()->property("currentB").toInt(), 2); QCOMPARE(pathview->currentItem(), firstItem); @@ -1002,7 +1002,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 1); firstItem = findItem(pathview, "wrapper", 1); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1010,7 +1010,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 0); firstItem = findItem(pathview, "wrapper", 0); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1018,7 +1018,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 3); firstItem = findItem(pathview, "wrapper", 3); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1026,7 +1026,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 0); firstItem = findItem(pathview, "wrapper", 0); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1035,7 +1035,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 2); firstItem = findItem(pathview, "wrapper", 2); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1044,7 +1044,7 @@ void tst_QQuickPathView::setCurrentIndex() QTRY_COMPARE(pathview->currentIndex(), 1); firstItem = findItem(pathview, "wrapper", 1); QVERIFY(firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); @@ -1056,7 +1056,7 @@ void tst_QQuickPathView::setCurrentIndex() firstItem = findItem(pathview, "wrapper", 3); QVERIFY(firstItem); QCOMPARE(pathview->currentItem(), firstItem); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); model.moveItem(3, 0); pathview->setCurrentIndex(0); pathview->setHighlightMoveDuration(300); @@ -1565,12 +1565,12 @@ void tst_QQuickPathView::changePreferredHighlight() QPointF offset;//Center of item is at point, but pos is from corner offset.setX(firstItem->width()/2); offset.setY(firstItem->height()/2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); pathview->setPreferredHighlightBegin(0.8); pathview->setPreferredHighlightEnd(0.8); start = path->pointAt(0.8); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); QCOMPARE(pathview->currentIndex(), 0); delete window; @@ -1627,7 +1627,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QPointF offset;//Center of item is at point, but pos is from corner offset.setX(item->width()/2); offset.setY(item->height()/2); - QCOMPARE(item->pos() + offset, start); + QCOMPARE(item->position() + offset, start); QSignalSpy currentIndexSpy(pathview, SIGNAL(currentIndexChanged())); @@ -1641,7 +1641,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QVERIFY(item = findItem(pathview, "wrapper", 1)); // verify that current item (item 1) is still at offset 0.5 - QCOMPARE(item->pos() + offset, start); + QCOMPARE(item->position() + offset, start); // insert another item at the beginning model.insertItem(0, "item2", "2"); @@ -1653,7 +1653,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QVERIFY(item = findItem(pathview, "wrapper", 2)); // verify that current item (item 2) is still at offset 0.5 - QCOMPARE(item->pos() + offset, start); + QCOMPARE(item->position() + offset, start); // verify that remove before current maintains current item model.removeItem(0); @@ -1665,7 +1665,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QVERIFY(item = findItem(pathview, "wrapper", 1)); // verify that current item (item 1) is still at offset 0.5 - QCOMPARE(item->pos() + offset, start); + QCOMPARE(item->position() + offset, start); delete window; } @@ -1714,13 +1714,13 @@ void tst_QQuickPathView::asynchronous() QPointF offset;//Center of item is at point, but pos is from corner offset.setX(firstItem->width()/2); offset.setY(firstItem->height()/2); - QTRY_COMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->position() + offset, start); pathview->setOffset(1.0); for (int i=0; i<5; i++) { QQuickItem *curItem = findItem(pathview, "wrapper", i); QPointF itemPos(path->pointAt(0.2 + i*0.2)); - QCOMPARE(curItem->pos() + offset, itemPos); + QCOMPARE(curItem->position() + offset, itemPos); } delete window; diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 3966fff..ea2ad71 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -3226,7 +3226,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(currentRect, previousRect); // Verify that the micro focus rect moves to the left as the cursor position @@ -3240,7 +3240,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QVERIFY(previousRect.left() < currentRect.left()); QCOMPARE(editSpy.count(), 1); editSpy.clear(); QCOMPARE(panelSpy.count(), 1); panelSpy.clear(); @@ -3257,7 +3257,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(editSpy.count(), 1); QCOMPARE(panelSpy.count(), 1); @@ -3270,7 +3270,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QCoreApplication::sendEvent(edit, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(edit->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(currentRect, previousRect); QCOMPARE(editSpy.count(), 1); QCOMPARE(panelSpy.count(), 1); diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 49e72e4..7e45bd1 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3224,7 +3224,7 @@ void tst_qquicktextinput::passwordEchoDelay() QCOMPARE(input->displayText(), QString(4, fillChar)); QTest::keyPress(&window, '4'); QCOMPARE(input->displayText(), QString(4, fillChar) + QLatin1Char('4')); - QCOMPARE(input->cursorRectangle().topLeft(), cursor->pos()); + QCOMPARE(input->cursorRectangle().topLeft(), cursor->position()); // Verify the last character entered is replaced by the fill character after a delay. // Also check the cursor position is updated to accomdate a size difference between @@ -3233,7 +3233,7 @@ void tst_qquicktextinput::passwordEchoDelay() QTest::qWait(maskDelay); QTRY_COMPARE(input->displayText(), QString(5, fillChar)); QCOMPARE(cursorSpy.count(), 1); - QCOMPARE(input->cursorRectangle().topLeft(), cursor->pos()); + QCOMPARE(input->cursorRectangle().topLeft(), cursor->position()); QTest::keyPress(&window, '5'); QCOMPARE(input->displayText(), QString(5, fillChar) + QLatin1Char('5')); @@ -3653,7 +3653,7 @@ void tst_qquicktextinput::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(currentRect, previousRect); QCOMPARE(input->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QSignalSpy inputSpy(input, SIGNAL(cursorRectangleChanged())); QSignalSpy panelSpy(qGuiApp->inputMethod(), SIGNAL(cursorRectangleChanged())); @@ -3666,7 +3666,7 @@ void tst_qquicktextinput::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QVERIFY(previousRect.left() < currentRect.left()); QCOMPARE(input->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QVERIFY(inputSpy.count() > 0); inputSpy.clear(); QVERIFY(panelSpy.count() > 0); panelSpy.clear(); previousRect = currentRect; @@ -3680,7 +3680,7 @@ void tst_qquicktextinput::preeditCursorRectangle() QCoreApplication::sendEvent(input, &query); currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(input->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(inputSpy.count(), 1); QCOMPARE(panelSpy.count(), 1); @@ -3694,7 +3694,7 @@ void tst_qquicktextinput::preeditCursorRectangle() currentRect = query.value(Qt::ImCursorRectangle).toRectF(); QCOMPARE(currentRect, previousRect); QCOMPARE(input->cursorRectangle(), currentRect); - QCOMPARE(cursor->pos(), currentRect.topLeft()); + QCOMPARE(cursor->position(), currentRect.topLeft()); QCOMPARE(inputSpy.count(), 1); QCOMPARE(panelSpy.count(), 1); } @@ -3990,7 +3990,7 @@ void tst_qquicktextinput::tripleClickSelectsAll() // Clicking on the same point inside TextInput three times in a row // should trigger a triple click, thus selecting all the text. - QPoint pointInside = input->pos().toPoint() + QPoint(2,2); + QPoint pointInside = input->position().toPoint() + QPoint(2,2); QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside); QGuiApplication::processEvents(); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 5cede36..ec9d0e2 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -349,12 +349,12 @@ void tst_qquickwindow::touchEvent_basic() TestTouchItem *middleItem = new TestTouchItem(bottomItem); middleItem->setObjectName("Middle Item"); - middleItem->setPos(QPointF(50, 50)); + middleItem->setPosition(QPointF(50, 50)); middleItem->setSize(QSizeF(150, 150)); TestTouchItem *topItem = new TestTouchItem(middleItem); topItem->setObjectName("Top Item"); - topItem->setPos(QPointF(50, 50)); + topItem->setPosition(QPointF(50, 50)); topItem->setSize(QSizeF(150, 150)); QPointF pos(10, 10); @@ -478,12 +478,12 @@ void tst_qquickwindow::touchEvent_propagation() TestTouchItem *middleItem = new TestTouchItem(bottomItem); middleItem->setObjectName("Middle Item"); - middleItem->setPos(QPointF(50, 50)); + middleItem->setPosition(QPointF(50, 50)); middleItem->setSize(QSizeF(150, 150)); TestTouchItem *topItem = new TestTouchItem(middleItem); topItem->setObjectName("Top Item"); - topItem->setPos(QPointF(50, 50)); + topItem->setPosition(QPointF(50, 50)); topItem->setSize(QSizeF(150, 150)); QPointF pos(10, 10); @@ -606,7 +606,7 @@ void tst_qquickwindow::touchEvent_cancel() QVERIFY(QTest::qWaitForWindowExposed(window)); TestTouchItem *item = new TestTouchItem(window->contentItem()); - item->setPos(QPointF(50, 50)); + item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); QPointF pos(10, 10); @@ -642,7 +642,7 @@ void tst_qquickwindow::touchEvent_reentrant() item->spinLoopWhenPressed = true; // will call processEvents() from the touch handler - item->setPos(QPointF(50, 50)); + item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); QPointF pos(60, 60); @@ -677,7 +677,7 @@ void tst_qquickwindow::touchEvent_velocity() QTest::qWait(10); TestTouchItem *item = new TestTouchItem(window->contentItem()); - item->setPos(QPointF(50, 50)); + item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); QList points; @@ -733,7 +733,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QTest::qWait(10); TestTouchItem *item = new TestTouchItem(window->contentItem()); - item->setPos(QPointF(50, 50)); + item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); item->acceptTouchEvents = false; @@ -816,12 +816,12 @@ void tst_qquickwindow::mouseFiltering() TestTouchItem *middleItem = new TestTouchItem(bottomItem); middleItem->setObjectName("Middle Item"); - middleItem->setPos(QPointF(50, 50)); + middleItem->setPosition(QPointF(50, 50)); middleItem->setSize(QSizeF(150, 150)); TestTouchItem *topItem = new TestTouchItem(middleItem); topItem->setObjectName("Top Item"); - topItem->setPos(QPointF(50, 50)); + topItem->setPosition(QPointF(50, 50)); topItem->setSize(QSizeF(150, 150)); QPoint pos(100, 100); @@ -1077,23 +1077,23 @@ void tst_qquickwindow::cursor() window.resize(320, 240); QQuickItem parentItem; - parentItem.setPos(QPointF(0, 0)); + parentItem.setPosition(QPointF(0, 0)); parentItem.setSize(QSizeF(180, 180)); parentItem.setParentItem(window.contentItem()); QQuickItem childItem; - childItem.setPos(QPointF(60, 90)); + childItem.setPosition(QPointF(60, 90)); childItem.setSize(QSizeF(120, 120)); childItem.setParentItem(&parentItem); QQuickItem clippingItem; - clippingItem.setPos(QPointF(120, 120)); + clippingItem.setPosition(QPointF(120, 120)); clippingItem.setSize(QSizeF(180, 180)); clippingItem.setClip(true); clippingItem.setParentItem(window.contentItem()); QQuickItem clippedItem; - clippedItem.setPos(QPointF(-30, -30)); + clippedItem.setPosition(QPointF(-30, -30)); clippedItem.setSize(QSizeF(120, 120)); clippedItem.setParentItem(&clippingItem); diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 0590bd8..1af70e3 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -703,7 +703,7 @@ void tst_TouchMouse::pinchOnFlickable() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); - QCOMPARE(rect->pos(), QPointF(200.0, 200.0)); + QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); p -= QPoint(10, 0); @@ -770,7 +770,7 @@ void tst_TouchMouse::flickableOnPinch() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); - QCOMPARE(rect->pos(), QPointF(200.0, 200.0)); + QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); p -= QPoint(10, 0); @@ -785,7 +785,7 @@ void tst_TouchMouse::flickableOnPinch() QTest::qWait(1000); //QVERIFY(flickable->isMovingHorizontally()); - qDebug() << "Pos: " << rect->pos(); + qDebug() << "Pos: " << rect->position(); // wait until flicking is done QTRY_VERIFY(!flickable->isFlicking()); @@ -839,7 +839,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); - QCOMPARE(rect->pos(), QPointF(200.0, 200.0)); + QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); p -= QPoint(10, 0); @@ -851,7 +851,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() QGuiApplication::processEvents(); //QVERIFY(flickable->isMovingHorizontally()); - qDebug() << "Pos: " << rect->pos(); + qDebug() << "Pos: " << rect->position(); // pinch QPoint p1 = QPoint(40, 20); @@ -885,7 +885,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() flickable->setContentX(0.0); p = QPoint(100, 100); pinchSequence.press(0, p, window).commit(); - QCOMPARE(rect->pos(), QPointF(200.0, 200.0)); + QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); pinchSequence.move(0, p, window).commit(); p -= QPoint(10, 0); -- 2.7.4