Hello everyone,
I have an array in qml code defined as a property in a Component
property var myarray: [ ]
Component.onCompleted: myarray = populateMyArray();
Then I define:
onMyarrayChanged: console.log("myarray changed!") // just for test
Now each time I reassign the array myarray this way:
myarray = [ /* Some contents here */]
onMyarrayChanged is called correctly, but if I call a Array.prototype method, for example:
myarray.push("Another element")
onMyarrayChanged isn’t called at all as I would like, because without the signal myarrayChanged, ListViews or Repeater that uses myarray as a model aren’t updated accordingly. The only way is to reassign the model or do this:
myarray = myarray
Is there another way I haven’t thought of? Is this a bug or the expected behaviour?
Thanks for your support,
Giulio
↧