diff options
Diffstat (limited to 'benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml')
-rw-r--r-- | benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml b/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml new file mode 100644 index 0000000..0afa7ee --- /dev/null +++ b/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml @@ -0,0 +1,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); + } + } +} |