diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativerepeater/data')
6 files changed, 173 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml new file mode 100644 index 0000000..cf1fb4d --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml @@ -0,0 +1,29 @@ +import Qt 4.6 + +Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + + function checkProperties() { + testObject.error = false; + if (repeater.delegate != comp) { + console.log("delegate property incorrect"); + testObject.error = true; + } + } + + Component { + id: comp + Item{} + } + + Repeater { + id: repeater + objectName: "repeater" + model: testData + delegate: comp + } +} diff --git a/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml new file mode 100644 index 0000000..fc6b34c --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml @@ -0,0 +1,49 @@ +// This example demonstrates placing items in a view using +// a VisualItemModel + +import Qt 4.6 + +Rectangle { + color: "lightgray" + width: 240 + height: 320 + + function checkProperties() { + testObject.error = false; + if (testObject.useModel && view.model != itemModel) { + console.log("model property incorrect"); + testObject.error = true; + } + } + + VisualItemModel { + id: itemModel + objectName: "itemModel" + Rectangle { + objectName: "item1" + height: view.height; width: view.width; color: "#FFFEF0" + Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item2" + height: view.height; width: view.width; color: "#F0FFF7" + Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + Rectangle { + objectName: "item3" + height: view.height; width: view.width; color: "#F4F0FF" + Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } + } + } + + Column { + objectName: "container" + Repeater { + id: view + objectName: "repeater" + anchors.fill: parent + anchors.bottomMargin: 30 + model: testObject.useModel ? itemModel : 0 + } + } +} diff --git a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml new file mode 100644 index 0000000..e6d0acb --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml @@ -0,0 +1,21 @@ +import Qt 4.6 + +Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + Repeater { + id: repeater + objectName: "repeater" + model: testData + property int errors: 0 + property int instantiated: 0 + Component { + Item{ + Component.onCompleted: {if(index!=model.idx) repeater.errors += 1; repeater.instantiated++} + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativerepeater/data/properties.qml b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml new file mode 100644 index 0000000..550ce8d --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +Row { + Repeater { + objectName: "repeater" + model: 5 + Text { + text: "I'm item " + index + } + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativerepeater/data/repeater.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater.qml new file mode 100644 index 0000000..7d83230 --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater.qml @@ -0,0 +1,28 @@ +import Qt 4.6 + +Rectangle { + id: container + objectName: "container" + width: 240 + height: 320 + color: "white" + Text { + text: "Zero" + } + Repeater { + id: repeater + objectName: "repeater" + width: 240 + height: 320 + model: testData + Component { + Text { + y: index*20 + text: modelData + } + } + } + Text { + text: "Last" + } +} diff --git a/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml new file mode 100644 index 0000000..c3c3260 --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml @@ -0,0 +1,35 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "white" + Component { + id: myDelegate + Item { + objectName: "myDelegate" + height: 20 + Text { + y: index*20 + text: name + } + Text { + y: index*20 + x: 100 + text: number + } + } + } + Column { + id: container + objectName: "container" + Repeater { + id: repeater + objectName: "repeater" + width: 240 + height: 320 + delegate: myDelegate + model: testData + } + } +} |