Rewrite the canvas item's paint logic.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativerepeater / data / itemlist.qml
1 // This example demonstrates placing items in a view using
2 // a VisualItemModel
3
4 import QtQuick 1.0
5
6 Rectangle {
7     id: root
8     color: "lightgray"
9     width: 240
10     height: 320
11     property variant itemModel: itemModel1
12
13     function checkProperties() {
14         testObject.error = false;
15         if (testObject.useModel && view.model != root.itemModel) {
16             console.log("model property incorrect");
17             testObject.error = true;
18         }
19     }
20
21     function switchModel() {
22         root.itemModel = itemModel2
23     }
24
25     VisualItemModel {
26         id: itemModel1
27         objectName: "itemModel1"
28         Rectangle {
29             objectName: "item1"
30             height: 50; width: 100; color: "#FFFEF0"
31             Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
32         }
33         Rectangle {
34             objectName: "item2"
35             height: 50; width: 100; color: "#F0FFF7"
36             Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
37         }
38         Rectangle {
39             objectName: "item3"
40             height: 50; width: 100; color: "#F4F0FF"
41             Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
42         }
43     }
44
45     VisualItemModel {
46         id: itemModel2
47         objectName: "itemModel2"
48         Rectangle {
49             objectName: "item4"
50             height: 50; width: 100; color: "#FFFEF0"
51             Text { objectName: "text4"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
52         }
53         Rectangle {
54             objectName: "item5"
55             height: 50; width: 100; color: "#F0FFF7"
56             Text { objectName: "text5"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent }
57         }
58     }
59
60     Column {
61         objectName: "container"
62         Repeater {
63             id: view
64             objectName: "repeater"
65             model: testObject.useModel ? root.itemModel : 0
66         }
67     }
68 }