~saviq/ubuntu/saucy/qtdeclarative-opensource-src/add-qtquick-delegate-range

« back to all changes in this revision

Viewing changes to tests/auto/quick/qquickgridview/data/snapOneRow.qml

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 14:17:19 UTC
  • Revision ID: package-import@ubuntu.com-20130205141719-qqeyml8wslpyez52
Tags: upstream-5.0.1
ImportĀ upstreamĀ versionĀ 5.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: 120
 
15
            width: 120
 
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: 120
 
32
        cellHeight: 120
 
33
        preferredHighlightBegin: 20
 
34
        preferredHighlightEnd: 140
 
35
        snapMode: GridView.SnapOneRow
 
36
        layoutDirection: Qt.RightToLeft
 
37
        flow: GridView.TopToBottom
 
38
        highlightRangeMode: GridView.StrictlyEnforceRange
 
39
        highlight: Rectangle { width: 120; height: 120; color: "yellow" }
 
40
        model: 8
 
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
}