diff options
Diffstat (limited to 'doc/src/snippets/declarative/dynamicObjects.qml')
| -rw-r--r-- | doc/src/snippets/declarative/dynamicObjects.qml | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/doc/src/snippets/declarative/dynamicObjects.qml b/doc/src/snippets/declarative/dynamicObjects.qml new file mode 100644 index 0000000..6a8c927 --- /dev/null +++ b/doc/src/snippets/declarative/dynamicObjects.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +//![0] +Rectangle { +    id: rootItem +    width: 300 +    height: 300 + +    Component { +        id: rectComponent + +        Rectangle { +            id: rect +            width: 40; height: 40; +            color: "red" + +            NumberAnimation on opacity { from: 1; to: 0; duration: 1000 } + +            Component.onCompleted: rect.destroy(1000); +        } +    } + +    function createRectangle() { +        var object = rectComponent.createObject(rootItem); +    }  + +    Component.onCompleted: createRectangle() +} +//![0] | 
