blob: 0afa7ee0b0142ce9f8766e1b63f2b5fce3549f27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import QtQuick 2.0
Item {
id: root;
property int count: 50;
property int staticCount: 5000;
property var items;
property real t;
NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
onTChanged: {
allocate();
}
Component {
id: component;
Item {
}
}
function allocate() {
if (items && items.length) {
for (var i=0; i<items.length; ++i)
items[i].destroy();
}
items = [];
for (var i=0; i<root.count; ++i) {
var object = component.createObject(root);
items.push(object);
}
}
}
|