aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication/pages/Page2.qml
diff options
context:
space:
mode:
Diffstat (limited to 'DemoApplication/pages/Page2.qml')
-rw-r--r--DemoApplication/pages/Page2.qml79
1 files changed, 69 insertions, 10 deletions
diff --git a/DemoApplication/pages/Page2.qml b/DemoApplication/pages/Page2.qml
index 40be56c..76b45f1 100644
--- a/DemoApplication/pages/Page2.qml
+++ b/DemoApplication/pages/Page2.qml
@@ -18,12 +18,42 @@ Item {
id: listView
width: 198
height: 359
- //anchors.right: parent.right
- //anchors.top: parent.top
- //anchors.topMargin: 20
+
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"
@@ -74,17 +104,11 @@ Item {
CNButton {
anchors.horizontalCenter: parent.horizontalCenter
id: button3
- //anchors.top: listView.bottom
- //anchors.topMargin: 20
- //anchors.right: parent.right
- //anchors.rightMargin: 60
text: qsTr("Button")
}
}
+
Column {
- //anchors.verticalCenter: parent.verticalCenter
- //anchors.left: parent.left
- //anchors.leftMargin: 50
spacing: 30
CNButton {
text: qsTr("Button")
@@ -99,5 +123,40 @@ Item {
}
}
+ 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
+ }
+
}
}