Sorry, I wasn’t clear. The delegates cannot be stored (they’re managed by the listview). But state-information associated with a delegate could be stored.
pseudocode below:
Item {
id: root
property var stateInformation: []
ListView {
model: someModel
delegate: deleg
}
Component {
id: deleg
Rectangle {
property bool isRed: root.stateInformation[index] === true ? true : false
color: isRed ? "red" : "blue"
onColorChanged: {
var si = root.stateInformation
si[index] = isRed
root.stateInformation = si
}
MouseArea {
anchors.fill: parent
onClicked: {
if (parent.isRed) {
parent.isRed = false
} else {
parent.isRed = true
}
}
}
}
}
}
↧








