native: add list

This commit is contained in:
Johannes Jöns 2024-07-09 18:37:01 +02:00
parent 5ac74aa5c0
commit 2a2fa7e073
3 changed files with 37 additions and 1 deletions

View file

@ -17,6 +17,7 @@ qt_add_qml_module(alisa
VERSION 1.0
QML_FILES
Main.qml
Data.qml
RESOURCES
Assets/Icons/turbo.svg

16
native/Data.qml Normal file
View file

@ -0,0 +1,16 @@
import QtQuick
ListModel {
ListElement {
name: "Bill Smith"
number: "555 3264"
}
ListElement {
name: "John Brown"
number: "555 8426"
}
ListElement {
name: "Sam Wise"
number: "555 0473"
}
}

View file

@ -26,9 +26,28 @@ Window {
left: parent.left
right: parent.right
}
height: 50
height: 400
border.width: 5
border.color: getColors().accent
color: getColors().midlight
Component {
id: contactDelegate
Item {
width: 180; height: 40
Column {
Text { text: '<b>Name:</b> ' + name }
Text { text: '<b>Number:</b> ' + number }
}
}
}
ListView {
anchors.fill: parent
model: Data {}
delegate: contactDelegate
highlight: Rectangle { color: getColors().highlight; radius: 5 }
focus: true
}
}
}