aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication/pages/Page2.qml
blob: 76b45f1ae1e6801ad608486d360406e1093b864e (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import QtQuick 2.9
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3

import CursorNavigation 1.0
import controls 1.0

Item {
    width: parent.width
    height: parent.height

    RowLayout {
        anchors.fill: parent
        spacing: 10

        Column {
            CNListView {
                id: listView
                width: 198
                height: 359

                spacing: 4
                clip: true

                delegate: CNItemDelegate {
                    width: listView.width
                    height: 40

                    contentItem: Item {
                        width: listView.width
                        height: 40

                        Row {
                            width: (parent.width - x)
                            height: 35
                            x: 5
                            anchors.verticalCenter: parent.verticalCenter
                            spacing: 10

                            Rectangle {
                                width: parent.height
                                height: parent.height
                                radius: width/2
                                color: colorCode
                            }

                            Text {
                                height: parent.height
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter
                                text: name
                            }
                        }
                    }
                }

                model: ListModel {
                    ListElement {
                        name: "Grey"
                        colorCode: "grey"
                    }
                    ListElement {
                        name: "Red"
                        colorCode: "red"
                    }
                    ListElement {
                        name: "Blue"
                        colorCode: "blue"
                    }
                    ListElement {
                        name: "Green"
                        colorCode: "green"
                    }
                    ListElement {
                        name: "Cyan"
                        colorCode: "cyan"
                    }
                    ListElement {
                        name: "Magenta"
                        colorCode: "magenta"
                    }
                    ListElement {
                        name: "Yellow"
                        colorCode: "yellow"
                    }
                    ListElement {
                        name: "Black"
                        colorCode: "black"
                    }
                    ListElement {
                        name: "Aliceblue"
                        colorCode: "aliceblue"
                    }
                    ListElement {
                        name: "Blueviolet"
                        colorCode: "blueviolet"
                    }
                    ListElement {
                        name: "Coral"
                        colorCode: "coral"
                    }
                }
            }
            CNButton {
                anchors.horizontalCenter: parent.horizontalCenter
                id: button3
                text: qsTr("Button")
            }
        }

        Column {
            spacing: 30
            CNButton {
                text: qsTr("Button")
            }

            CNButton {
                text: qsTr("Button")
            }

            CNButton {
                text: qsTr("Button")
            }
        }

        CNListView {
            id: listView2
            width: 198
            height: 359

            spacing: 4
            clip: true

            /* when we set acceptsCursor false for the ListView itself,
             * navigation between the list items and items outside of the list,
             * is based on the item geometry and not just the whole ListView's geometry
             */
            CursorNavigation.acceptsCursor: false

            delegate: CNItemDelegate {
                width: listView.width
                height: 40

                CursorNavigation.onActivated: checkBox.toggle()

                contentItem: Item {
                    width: listView.width
                    height: 40

                    CheckBox{
                        id: checkBox
                        text: "Item " + index
                        anchors.centerIn: parent
                    }
                }
            }

            model: 10
        }

    }
}