f079a048f0edb7bc1325607b746e77a419036012
[profile/ivi/qtdeclarative.git] / tests / auto / qtquick2 / qquickgridview / data / snapToRow.qml
1 import QtQuick 2.0
2
3 Rectangle {
4     id: root
5     width: 240
6     height: 240
7     color: "#ffffff"
8
9     Component {
10         id: myDelegate
11         Rectangle {
12             id: wrapper
13             objectName: "wrapper"
14             height: 80
15             width: 80
16             Column {
17                 Text {
18                     text: index
19                 }
20                 Text {
21                     text: wrapper.x + ", " + wrapper.y
22                 }
23             }
24             color: GridView.isCurrentItem ? "lightsteelblue" : "transparent"
25         }
26     }
27     GridView {
28         id: grid
29         objectName: "grid"
30         anchors.fill: parent
31         cellWidth: 80
32         cellHeight: 80
33         preferredHighlightBegin: 20
34         preferredHighlightEnd: 100
35         snapMode: GridView.SnapToRow
36         layoutDirection: Qt.RightToLeft
37         flow: GridView.TopToBottom
38         highlightRangeMode: GridView.StrictlyEnforceRange
39         highlight: Rectangle { width: 80; height: 80; color: "yellow" }
40         model: 54
41         delegate: myDelegate
42     }
43
44     Text {
45         anchors.right: parent.right
46         anchors.bottom: parent.bottom
47         text: grid.contentX + ", " + grid.contentY
48     }
49 }