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