Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qdeclarativegridview / data / gridview1.qml
1 import QtQuick 1.1
2
3 Rectangle {
4     id: root
5     property bool showHeader: false
6     property bool showFooter: false
7     property int added: -1
8     property variant removed
9
10     width: 240
11     height: 320
12     color: "#ffffff"
13     resources: [
14         Component {
15             id: myDelegate
16             Rectangle {
17                 id: wrapper
18                 objectName: "wrapper"
19                 width: 80
20                 height: 60
21                 border.color: "blue"
22                 Text {
23                     text: index
24                 }
25                 Text {
26                     x: 40
27                     text: wrapper.x + ", " + wrapper.y
28                 }
29                 Text {
30                     y: 20
31                     id: textName
32                     objectName: "textName"
33                     text: name
34                 }
35                 Text {
36                     y: 40
37                     id: textNumber
38                     objectName: "textNumber"
39                     text: number
40                 }
41                 color: GridView.isCurrentItem ? "lightsteelblue" : "white"
42                 GridView.onAdd: root.added = index
43                 GridView.onRemove: root.removed = name
44             }
45         },
46         Component {
47             id: headerFooter
48             Rectangle { width: 30; height: 320; color: "blue" }
49         }
50     ]
51     GridView {
52         id: grid
53         objectName: "grid"
54         width: 240
55         height: 320
56         cellWidth: 80
57         cellHeight: 60
58         flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom
59         layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight
60         model: testModel
61         delegate: myDelegate
62         header: root.showHeader ? headerFooter : null
63         footer: root.showFooter ? headerFooter : null
64     }
65 }