例如
ListView {
id: listView
anchors.fill: parent
anchors.margins: 20
model: myModel
delegate: myDelegate
highlightFollowsCurrentItem: true
focus: true
ListModel {
id: myModel
ListElement {
name: "Apple"; cost: 2.45
attributes: [
ListElement { description: "Core" },
ListElement { description: "Deciduous" }
]
isOnMouse: false
}
}
我使用 myDelegate 作为任何模型的默认值,但是如果单击其中一个项目,我想为该项目使用另一个委托,仅用于该项目。
可能吗?