Here is my code, and it works!
ListModel {
id: idValueList
Component.onCompleted: {
for (var i = 0; i < 21; i++) {
append(createListElement(i));
}
}
function createListElement(id) {
return {
myId: id + 1, myValue: ""
};
}
}
However, I need to substitute the "21" in the for loop with myXmlListModel.get(myXmlListModel.count - 1).myValue, which comes from an XmlListModel, the dynamic list model stop working!
The funny part is that the code
Text{
x:0 ; y:0
text: myXmlListModel.get(myXmlListModel.count - 1).myValue;
}
prints for me exactly a 21. But if I use the expression myXmlListModel.get(myXmlListModel.count - 1).myValue in the for loop, nothing works.
How can it be possible??