diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.1.qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.1.qml | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.1.qml b/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.1.qml new file mode 100644 index 0000000000..4814ff33f4 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/scriptConnect.dynamic.1.qml @@ -0,0 +1,32 @@ +import Qt.test 1.0 +import QtQuick 2.0 +import "scriptConnect.6.js" as Script + +Item { + id: root + + property int test: 0 + property var dynamicObjectProperty: undefined + + signal outer + Component { + id: comp + Item { + signal inner + onInner: { Script.testFunction(); root.destroyDynamicObject(); } + } + } + + function destroyDynamicObject() { + if (dynamicObjectProperty) { + dynamicObjectProperty.destroy(); + dynamicObjectProperty = undefined; + gc(); + } + } + + Component.onCompleted: { + dynamicObjectProperty = comp.createObject(root); + root.outer.connect(dynamicObjectProperty.inner); + } +} |