diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-04-03 11:50:05 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-03 07:50:17 +0200 |
commit | 817c0741d1d3e1dc1c505652ba764fe96b584aac (patch) | |
tree | fbd1519ae832cd6406525a8bfe624a37f426a012 /tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml | |
parent | b3264e2cb6a8fe87754aa1335ab9f8d5e3910c14 (diff) |
Allow objects created in QML with incubateObject to be destroyed.
Change-Id: I8a0678ea8dff6f4a40ac367395a99dd025f7f08a
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml b/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml new file mode 100644 index 0000000000..6f536b27ca --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml @@ -0,0 +1,27 @@ +import QtQuick 2.0 + +Item { + id: root + + property QtObject incubatedItem + + Component.onCompleted: { + var component = Qt.createComponent("PropertyVarBaseItem.qml"); + + var incubator = component.incubateObject(root); + if (incubator.status != Component.Ready) { + incubator.onStatusChanged = function(status) { + if (status == Component.Ready) { + incubatedItem = incubator.object; + } + } + } else { + incubatedItem = incubator.object; + } + } + + function deleteIncubatedItem() { + incubatedItem.destroy(); + gc(); + } +} |