aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickpathview/data
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2014-07-21 14:55:30 +0200
committerMitch Curtis <mitch.curtis@digia.com>2014-07-24 10:17:13 +0200
commit1416e6bd3ec4aaefe33bb64c9ad64d251f7f2885 (patch)
tree9c3ad42a4d18e543473ce57e925fe4b7f985c5ad /tests/auto/quick/qquickpathview/data
parentbca2eb550de0148dc53aeb1f9e7a036a692fd01d (diff)
Schedule layout changes to avoid refill() recursion.
Otherwise we add duplicate item delegates. Task-number: QTBUG-40298 Change-Id: I8a2221d72f458c892720a71d87513808a5d725a6 Reviewed-by: Martin Jones <martin.jones@jollamobile.com>
Diffstat (limited to 'tests/auto/quick/qquickpathview/data')
-rw-r--r--tests/auto/quick/qquickpathview/data/changePathDuringRefill.qml45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/data/changePathDuringRefill.qml b/tests/auto/quick/qquickpathview/data/changePathDuringRefill.qml
new file mode 100644
index 0000000000..f02ab35faf
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/changePathDuringRefill.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.3
+
+PathView {
+ id: view
+ objectName: "pathView"
+ width: 100
+ height: delegateHeight * pathItemCount
+ model: ["A", "B", "C"]
+ pathItemCount: 3
+ anchors.centerIn: parent
+
+ property int delegateHeight: 0
+
+ activeFocusOnTab: true
+ Keys.onDownPressed: view.incrementCurrentIndex()
+ Keys.onUpPressed: view.decrementCurrentIndex()
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+
+ delegate: Rectangle {
+ objectName: "delegate" + modelData
+ width: view.width
+ height: textItem.height
+ border.color: "red"
+
+ onHeightChanged: {
+ if (index == 0)
+ view.delegateHeight = textItem.height
+ }
+
+ Text {
+ id: textItem
+ text: modelData
+ }
+ }
+
+ path: Path {
+ startX: view.width / 2
+ startY: 0
+ PathLine {
+ x: view.width / 2
+ y: view.pathItemCount * view.delegateHeight
+ }
+ }
+}