aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/data/ownershipQmlIncubated.qml
blob: 6f536b27ca7e7b8c2ed2adfa751696d754183cb2 (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
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();
    }
}