Hello, I have custom List delegate:
Item{
id: delegateItem
width: parent.width
height: 60
property string alarmImage
property string nurseImage
property string residentText
property StyleSimpleRow style: StyleSimpleRow {
indent: 15
}
RowLayout{
anchors{
top: parent.top
left: parent.left
right: parent.right
}
Image {
id: alarmImageItem
Layout.fillWidth: true
Layout.preferredWidth: 1
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignLeft
source: alarmImage
Component.onCompleted: {
print(height)
}
}
AppText {
id: residentTextItem
color: Theme.backgroundColor
font.pixelSize: dp(14)
font.bold: true
text: "residentText"
Component.onCompleted: {
print(height)
}
}
Image {
id: nurseImageItem
Layout.fillWidth: true
Layout.preferredWidth: 1
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignLeft
source: nurseImage
Component.onCompleted: {
print(height)
}
}
}
// Bottom cell divider
Rectangle {
id: divider
x: delegateItem.style.dividerLeftSpacing
width: parent.width - x
color: delegateItem.style.dividerColor
height: delegateItem.style.dividerHeight
anchors.bottom: parent.bottom
}
MouseArea{
anchors.fill: parent
onClicked: {
print(alarmImage + "\n" + residentText + "\n" + nurseImage)
}
}
}
This delegate does show no content, when I use it in a AppListView in that way:
ListElement{
identifier: 1
alarmImage: "../../assets/icons/icon_emergency_call.png"
residentText: "Helmut Mustermann"
locationText: "Badezimmer OG1"
timeText: "19:00"
nurseImage: "../../assets/icons/icon_nurse.png"
}
ListElement{
identifier: 2
alarmImage: "../../assets/icons/icon_emergency_call.png"
residentText: "Helmut Mustermann"
locationText: "Badezimmer OG1"
timeText: "19:00"
nurseImage: "../../assets/icons/icon_nurse.png"
}
}
AppListView{
model: listModel
anchors.fill: parent
delegate: ListDelegate {
//item: listModel.get(index)
alarmImage: model.alarmImage
residentText: model.locationText
//locationText: model.locationText
//timeText: model.timeText
nurseImage: model.nurseImage
//onSelected: navigationStack.popAllExceptFirstAndPush(detailEventPageComponent, {item: item})
Component.onCompleted: {
print(alarmImage + "\n" + residentText + "\n" + locationText)
}
}
}
What am I doing wrong?