[Interest] QML Repeater delegate not updating
Jason H
jhihn at gmx.com
Tue Nov 8 19:15:04 CET 2016
I'm really getting all tangled up in the QML Model stuff. I really wish there was a way to make JS models behave properly within Qt Models.
- When am I able to use modelData? (lists only? Why can't I use modelData.property?)
- When am I able to use anonymous property named directly? ("proper" models only?)
- When am I able to use listModel[index].property? (JS models)
- When am I required to use get(), set(), setProperty() ("proper models")
All that creates ambiguity on what model scheme I should be using. I'd argue that modelData should always be available to map to listModel[i] (or listModel.get(i)) This would allow someone like me who doesn't care so much about the model type to always be able to use modelData as a coding convention. It would also help avoid pain when changing the model type.
Anyway, here is my current head scratcher:
I have a Repeater that contains a Text. When the model data is updated the text of the Text should change, but it doesn't.
ListModel {
id: listModel
}
Repeater {
id: repeater
}
Component {
id: repeaterDelegate
Text {
text: listModel.get(index).filename.length > 0 ? "Bye" : "Hello" // <- when filename changes this does not update. Why is this not bindable?
// I'd like to write it as modelData.filename and have it work
}
}
... elsewhere...
listModel.setProperty(index, "filename", "something) // <- this should trigger the update
More information about the Interest
mailing list