aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmldesigner/data/merging/ListViewExpected.qml
blob: a8da56b1dff5997660e10b90c11eefaf70cca6c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import QtQuick 2.10

ListView {
    id: view
    width: listViewBackground.width
    height: listViewBackground.height
    highlight: Rectangle {
        id: listViewHighLight
        width: view.width
        height: 120
        color: "#343434"
        radius: 4
        border.color: "#0d52a4"
        border.width: 8
    }

    highlightMoveDuration: 0

    children: [
        Item {
             z: -1
             anchors.fill: parent

            Rectangle {
                id: listViewBackground
                width: 420
                height: 420
                color: "#69b5ec"
                anchors.fill: parent
            }
        }
    ]

    model: ListModel {
        ListElement {
            name: "Music"
        }
        ListElement {
            name: "Movies"
        }
        ListElement {
            name: "Camera"
        }
        ListElement {
            name: "Map"
        }
        ListElement {
            name: "Calendar"
        }
        ListElement {
            name: "Messaging"
        }
        ListElement {
            name: "Todo List"
        }
        ListElement {
            name: "Contacts"
        }
        ListElement {
            name: "Settings"
        }
    }


    delegate: Item {
        id: delegate
        width: ListView.view.width
        height: delegateNormal.height

        Rectangle {
            id: delegateNormal
            width: 420
            height: 120
            visible: true
            color: "#bdbdbd"
            radius: 4
            anchors.fill: parent
            anchors.margins: 12
            Text {
                id: labelNormal
                color: "#343434"
                text: name
                anchors.top: parent.top
                anchors.margins: 24
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }


        Rectangle {
            id: delegateHighlighted
            width: 420
            height: 120
            visible: false
            color: "#8125eb29"
            radius: 4
            anchors.fill: parent
            anchors.margins: 12
            Text {
                id: labelHighlighted
                color: "#efefef"
                text: name
                anchors.top: parent.top
                anchors.margins: 52
                anchors.horizontalCenter: parent.horizontalCenter
            }
        }

        MouseArea {
            anchors.fill: parent
            onClicked: delegate.ListView.view.currentIndex = index
        }


        states: [
            State {
                name: "Highlighted"

                when: delegate.ListView.isCurrentItem
                PropertyChanges {
                    target: delegateHighlighted
                    visible: true
                }

                PropertyChanges {
                    target: delegateNormal
                    visible: false
                }


            }
        ]
    }

}