qml 数组操作(qt quick1.1)
import Qt 4.7
Rectangle {
id: rect
width: 640
height: 480
property variant a: []
: {
("a==:", a==);
("isArray:", (a));
var aa = ; // reassigning half fixed the problem
for(var i=0; i< 4; i++) {
( i );
a = aa; // reassigning back fixed the rest of the problem
(i, "a > ", (), );
}
}
}
/*
Outputs the following:
a==: false
isArray: true
0 a > [0] 1
1 a > [0,1] 2
2 a > [0,1,2] 3
3 a > [0,1,2,3] 4
*/