Using a ListView with a simple delegate component.

This commit is contained in:
2026-03-05 10:53:52 +01:00
parent 7b6979288a
commit f1ad289411
3 changed files with 47 additions and 29 deletions

37
ListPage.qml Normal file
View File

@ -0,0 +1,37 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls.Material
Page {
id: page
Component {
id: contactDelegate
Item {
id: myItem
required property string name
required property string info
width: parent.width
height: 40
Column {
Text {
text: '<b>Name:</b> ' + myItem.name
}
Text {
text: '<b>Number:</b> ' + myItem.info
}
}
}
}
ListView {
anchors.fill: parent
model: mainModel
delegate: contactDelegate
highlight: Rectangle {
color: "lightsteelblue"
radius: 5
}
focus: true
}
}