summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/createQmlObject.qml
blob: 6b331c427f9a65a29f760ec727ac3c186e8491d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Qt 4.7

Rectangle {
    id: targetItem
    property QtObject newObject

    width: 100
    height: 100
    
    function createIt() {
//![0]
newObject = Qt.createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}',
    targetItem, "dynamicSnippet1");
//![0]
    }

    Component.onCompleted: createIt()
}