Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Some future release
-
None
Description
I would expect this to work:
property var myArray: ["a", "b", "c"] property var myPoint: { x: 100, y: 200 }; function addThreeToArray() { for(var i = 0; i < 3; i++) { myArray.push("X"); print("Array length: " + myArray.length + "; items: " + myArray.toString()); } ... similar for myPoint ... }
and print
Array length: 4; items: a,b,c,x
Array length: 5; items: a,b,c,x,x
Array length: 6; items: a,b,c,x,x,x
but it doesn't, it prints
Array length: 3; items: a,b,c
Array length: 3; items: a,b,c
Array length: 3; items: a,b,c
To get what I want, I have to move the code to a separate .js file (changing the
property definition to: var myArray = ["a", "b", "c"]; ) and then import it into my QML file.
Then it works as expected. Don't think I should have to.