Moving the list item delegate into its own QML file.
This commit is contained in:
22
ListPage.qml
22
ListPage.qml
@ -5,33 +5,15 @@ 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
|
||||
delegate: ListItemDelegate {}
|
||||
highlight: Rectangle {
|
||||
color: "lightsteelblue"
|
||||
radius: 5
|
||||
}
|
||||
focus: true
|
||||
clip: true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user