diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-19 01:29:35 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-19 10:18:59 (GMT) |
commit | 1773ebf6adccabe69280b7fbd3feb856ce2d779c (patch) | |
tree | 6d93adeeb416ca04c941301cdece8e627238ec60 /tests | |
parent | 6f0d46bbd3203fb1378234e37307800566588aca (diff) | |
download | Qt-1773ebf6adccabe69280b7fbd3feb856ce2d779c.zip Qt-1773ebf6adccabe69280b7fbd3feb856ce2d779c.tar.gz Qt-1773ebf6adccabe69280b7fbd3feb856ce2d779c.tar.bz2 |
Always place PathView delegates centered on the path
The scale of the delegate was used to offset the item. This was a
bad way of making the item appear to be positioned correctly when
the default transform origin was the top-left. Now that transform origin
is center, it is obvious that it was a bad idea.
Task-number: QTBUG-12245
Reviewed-by: Michael Brasser
(cherry picked from commit 5572ec653fe735c4f413195c1ef34382aa8c6105)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathview0.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml index 8956205..ff6f224 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml @@ -6,6 +6,7 @@ Rectangle { property int currentB: -1 property real delegateWidth: 60 property real delegateHeight: 20 + property real delegateScale: 1.0 width: 240 height: 320 color: "#ffffff" @@ -17,6 +18,7 @@ Rectangle { objectName: "wrapper" height: root.delegateHeight width: root.delegateWidth + scale: root.delegateScale color: PathView.isCurrentItem ? "lightsteelblue" : "white" border.color: "black" Text { diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index bf1e13a..fdbb16d 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -451,11 +451,19 @@ void tst_QDeclarativePathView::pathMoved() QCOMPARE(firstItem->pos() + offset, start); // Change delegate size + pathview->setOffset(0.1); + pathview->setOffset(0.0); canvas->rootObject()->setProperty("delegateWidth", 30); QCOMPARE(firstItem->width(), 30.0); offset.setX(firstItem->width()/2); QTRY_COMPARE(firstItem->pos() + offset, start); + // Change delegate scale + pathview->setOffset(0.1); + pathview->setOffset(0.0); + canvas->rootObject()->setProperty("delegateScale", 1.2); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } |