1f6cccddca1ab128c37b549419e3a7bdf9ec347e
[profile/ivi/qtdeclarative.git] / tests / auto / quick / qquicklistview / data / listview-initCurrent.qml
1 import QtQuick 2.0
2
3 Rectangle {
4     id: root
5
6     property int current: list.currentIndex
7     property bool showHeader: false
8     property bool showFooter: false
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                 height: 20
20                 width: 240
21                 Text {
22                     text: index
23                 }
24                 Text {
25                     x: 30
26                     id: textName
27                     objectName: "textName"
28                     text: name
29                 }
30                 Text {
31                     x: 120
32                     id: textNumber
33                     objectName: "textNumber"
34                     text: number
35                 }
36                 Text {
37                     x: 200
38                     text: wrapper.y
39                 }
40                 color: ListView.isCurrentItem ? "lightsteelblue" : "white"
41             }
42         }
43     ]
44
45     Component {
46         id: headerFooter
47         Rectangle { height: 30; width: 240; color: "blue" }
48     }
49
50     ListView {
51         id: list
52         objectName: "list"
53         focus: true
54         currentIndex: 20
55         width: 240
56         height: 320
57         keyNavigationWraps: testWrap
58         delegate: myDelegate
59         model: testModel
60         header: root.showHeader ? headerFooter : null
61         footer: root.showFooter ? headerFooter : null
62     }
63 }