This is consistent with the naming of other x/y properties, e.g.
contentX/Y, relativeX/Y etc.
Change-Id: I5159f8e54a6fda6a1f83a563ea9db47c3b8af238
Reviewed-by: Martin Jones <martin.jones@nokia.com>
if (vData.extentsChanged) {
vData.extentsChanged = false;
- emit q->yOriginChanged();
+ emit q->originYChanged();
}
if (hData.extentsChanged) {
hData.extentsChanged = false;
- emit q->xOriginChanged();
+ emit q->originXChanged();
}
if (atBoundaryChange)
}
/*!
- \qmlproperty real QtQuick2::Flickable::xOrigin
- \qmlproperty real QtQuick2::Flickable::yOrigin
+ \qmlproperty real QtQuick2::Flickable::originX
+ \qmlproperty real QtQuick2::Flickable::originY
- These properties hold the origin of the content. This is usually (0,0), however
- ListView and GridView may have an arbitrary origin due to delegate size variation,
- or item insertion/removal outside the visible region.
+ These properties hold the origin of the content. This value always refers
+ to the top-left position of the content regardless of layout direction.
+
+ This is usually (0,0), however ListView and GridView may have an arbitrary
+ origin due to delegate size variation, or item insertion/removal outside
+ the visible region.
*/
-qreal QQuickFlickable::yOrigin() const
+qreal QQuickFlickable::originY() const
{
Q_D(const QQuickFlickable);
return -minYExtent() + d->vData.startMargin;
}
-qreal QQuickFlickable::xOrigin() const
+qreal QQuickFlickable::originX() const
{
Q_D(const QQuickFlickable);
return -minXExtent() + d->hData.startMargin;
Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
- Q_PROPERTY(qreal yOrigin READ yOrigin NOTIFY yOriginChanged)
+ Q_PROPERTY(qreal originY READ originY NOTIFY originYChanged)
Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
- Q_PROPERTY(qreal xOrigin READ xOrigin NOTIFY xOriginChanged)
+ Q_PROPERTY(qreal originX READ originX NOTIFY originXChanged)
Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged)
Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged)
qreal rightMargin() const;
void setRightMargin(qreal m);
- virtual qreal yOrigin() const;
- virtual qreal xOrigin() const;
+ virtual qreal originY() const;
+ virtual qreal originX() const;
bool isMoving() const;
bool isMovingHorizontally() const;
void bottomMarginChanged();
void leftMarginChanged();
void rightMarginChanged();
- void yOriginChanged();
- void xOriginChanged();
+ void originYChanged();
+ void originXChanged();
void movingChanged();
void movingHorizontallyChanged();
void movingVerticallyChanged();
QQuickFlickable::setContentY(pos);
}
-qreal QQuickItemView::xOrigin() const
+qreal QQuickItemView::originX() const
{
Q_D(const QQuickItemView);
if (d->layoutOrientation() == Qt::Horizontal
&& contentWidth() < width()) {
return d->lastPosition() - d->footerSize();
}
- return QQuickFlickable::xOrigin();
+ return QQuickFlickable::originX();
}
-qreal QQuickItemView::yOrigin() const
+qreal QQuickItemView::originY() const
{
Q_D(const QQuickItemView);
if (d->layoutOrientation() == Qt::Vertical
&& contentHeight() < height()) {
return d->lastPosition() - d->footerSize();
}
- return QQuickFlickable::yOrigin();
+ return QQuickFlickable::originY();
}
void QQuickItemView::updatePolish()
virtual void setContentX(qreal pos);
virtual void setContentY(qreal pos);
- virtual qreal xOrigin() const;
- virtual qreal yOrigin() const;
+ virtual qreal originX() const;
+ virtual qreal originY() const;
signals:
void modelChanged();
QCOMPARE(obj->contentY(), -20.);
QCOMPARE(obj->contentWidth(), 1600.);
QCOMPARE(obj->contentHeight(), 600.);
- QCOMPARE(obj->xOrigin(), 0.);
- QCOMPARE(obj->yOrigin(), 0.);
+ QCOMPARE(obj->originX(), 0.);
+ QCOMPARE(obj->originY(), 0.);
// Reduce left margin
obj->setLeftMargin(30);
QCOMPARE(static_cast<GVAccessor*>(gridview)->maxX(), maxPos.x());
QCOMPARE(static_cast<GVAccessor*>(gridview)->maxY(), maxPos.y());
- QCOMPARE(gridview->xOrigin(), origin_empty.x());
- QCOMPARE(gridview->yOrigin(), origin_empty.y());
+ QCOMPARE(gridview->originX(), origin_empty.x());
+ QCOMPARE(gridview->originY(), origin_empty.y());
for (int i=0; i<30; i++)
model.addItem("Item" + QString::number(i), "");
QTRY_COMPARE(gridview->count(), model.count());
- QCOMPARE(gridview->xOrigin(), origin_nonEmpty.x());
- QCOMPARE(gridview->yOrigin(), origin_nonEmpty.y());
+ QCOMPARE(gridview->originX(), origin_nonEmpty.x());
+ QCOMPARE(gridview->originY(), origin_nonEmpty.y());
releaseView(canvas);
}
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
QCOMPARE(gridview->contentX(), -30.);
- QCOMPARE(gridview->xOrigin(), 0.);
+ QCOMPARE(gridview->originX(), 0.);
// check end bound
gridview->positionViewAtEnd();
QTRY_COMPARE(gridview->contentX(), pos + 50);
// remove item before visible and check that left margin is maintained
- // and xOrigin is updated
+ // and originX is updated
gridview->setContentX(200);
model.removeItems(0, 4);
QTest::qWait(100);
gridview->setContentX(-50);
gridview->returnToBounds();
- QCOMPARE(gridview->xOrigin(), 100.);
+ QCOMPARE(gridview->originX(), 100.);
QTRY_COMPARE(gridview->contentX(), 70.);
// reduce left margin
gridview->setLeftMargin(20);
- QCOMPARE(gridview->xOrigin(), 100.);
+ QCOMPARE(gridview->originX(), 100.);
QTRY_COMPARE(gridview->contentX(), 80.);
// check end bound
gridview->positionViewAtEnd();
- QCOMPARE(gridview->xOrigin(), 0.); // positionViewAtEnd() resets origin
+ QCOMPARE(gridview->originX(), 0.); // positionViewAtEnd() resets origin
pos = gridview->contentX();
gridview->setContentX(pos + 80);
gridview->returnToBounds();
// reduce right margin
pos = gridview->contentX();
gridview->setRightMargin(40);
- QCOMPARE(gridview->xOrigin(), 0.);
+ QCOMPARE(gridview->originX(), 0.);
QTRY_COMPARE(gridview->contentX(), pos-10);
delete canvas;
QTRY_VERIFY(contentItem != 0);
QTRY_COMPARE(gridview->contentX(), -240+50.);
- QTRY_COMPARE(gridview->xOrigin(), -100. * 10);
+ QTRY_COMPARE(gridview->originX(), -100. * 10);
// check end bound
gridview->positionViewAtEnd();
QTRY_COMPARE(gridview->contentX(), pos - 30);
// remove item before visible and check that left margin is maintained
- // and xOrigin is updated
+ // and originX is updated
gridview->setContentX(-400);
QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
model.removeItems(0, 4);
QTRY_COMPARE(model.count(), gridview->count());
gridview->setContentX(-240+50);
gridview->returnToBounds();
- QCOMPARE(gridview->xOrigin(), -1000.);
+ QCOMPARE(gridview->originX(), -1000.);
QTRY_COMPARE(gridview->contentX(), -240-50.);
// reduce right margin
pos = gridview->contentX();
gridview->setRightMargin(40);
- QCOMPARE(gridview->xOrigin(), -1000.);
+ QCOMPARE(gridview->originX(), -1000.);
QTRY_COMPARE(gridview->contentX(), -240-100 + 40.);
// check end bound
gridview->positionViewAtEnd();
- QCOMPARE(gridview->xOrigin(), -900.); // positionViewAtEnd() resets origin
+ QCOMPARE(gridview->originX(), -900.); // positionViewAtEnd() resets origin
pos = gridview->contentX();
gridview->setContentX(pos - 80);
gridview->returnToBounds();
// reduce left margin
pos = gridview->contentX();
gridview->setLeftMargin(20);
- QCOMPARE(gridview->xOrigin(), -900.);
+ QCOMPARE(gridview->originX(), -900.);
QTRY_COMPARE(gridview->contentX(), pos+10);
delete canvas;
QCOMPARE(static_cast<LVAccessor*>(listview)->maxX(), maxPos.x());
QCOMPARE(static_cast<LVAccessor*>(listview)->maxY(), maxPos.y());
- QCOMPARE(listview->xOrigin(), origin_empty.x());
- QCOMPARE(listview->yOrigin(), origin_empty.y());
+ QCOMPARE(listview->originX(), origin_empty.x());
+ QCOMPARE(listview->originY(), origin_empty.y());
for (int i=0; i<30; i++)
model.addItem("Item" + QString::number(i), "");
QTRY_COMPARE(listview->count(), model.count());
- QCOMPARE(listview->xOrigin(), origin_nonEmpty.x());
- QCOMPARE(listview->yOrigin(), origin_nonEmpty.y());
+ QCOMPARE(listview->originX(), origin_nonEmpty.x());
+ QCOMPARE(listview->originY(), origin_nonEmpty.y());
releaseView(canvas);
}
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
QCOMPARE(listview->contentY(), -30.);
- QCOMPARE(listview->yOrigin(), 0.);
+ QCOMPARE(listview->originY(), 0.);
// check end bound
listview->positionViewAtEnd();
QTRY_COMPARE(listview->contentY(), pos + 50);
// remove item before visible and check that top margin is maintained
- // and yOrigin is updated
+ // and originY is updated
listview->setContentY(100);
model.removeItem(1);
QTRY_COMPARE(listview->count(), model.count());
listview->setContentY(-50);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
listview->returnToBounds();
- QCOMPARE(listview->yOrigin(), 20.);
+ QCOMPARE(listview->originY(), 20.);
QTRY_COMPARE(listview->contentY(), -10.);
// reduce top margin
listview->setTopMargin(20);
- QCOMPARE(listview->yOrigin(), 20.);
+ QCOMPARE(listview->originY(), 20.);
QTRY_COMPARE(listview->contentY(), 0.);
// check end bound
// reduce bottom margin
pos = listview->contentY();
listview->setBottomMargin(40);
- QCOMPARE(listview->yOrigin(), 20.);
+ QCOMPARE(listview->originY(), 20.);
QTRY_COMPARE(listview->contentY(), pos-10);
delete canvas;