I’m trying to implement a listview and used your LevelSelectionScene.qml as a reference, but I can’t get it working properly.Everything works, except my model which points to a function which is a getValue call to my Storage. My storage currently contains
one JSON.stringified object which I want to set to the model.
FlickList.qml
Flickable {
id: flickable
property alias model: repeater.model
Repeater {
id: repeater
delegate: testDelegate
model: loadListModel()
onModelChanged: {
console.debug(“something changes”)
}
}
Component {
id: testDelegate()
Rectangle {
width: 100; height: 200
color: “black”
border.color: “black”
Text {
text: repeater.model[0].name // returnsĀ [undefined]
font.family: defaultFont.name
color: “white”
}
}
}
function loadListModel() {
console.log(“loading “)
return [parapendium.getValue(“test”)] // returns my object inside an array
}
}
In some other .qml where I use the FlickList.qml component from above I call explicit:
flickList.loadListModel() and my FlickList creates one object, but the properties inside the delegate can’t be resolved.
Why has it to be that complicated? D:
- This topic was modified 10 years, 7 months ago by supaiku.