summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/createQmlObject.qml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/declarative/createQmlObject.qml')
-rw-r--r--doc/src/snippets/declarative/createQmlObject.qml18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/snippets/declarative/createQmlObject.qml b/doc/src/snippets/declarative/createQmlObject.qml
new file mode 100644
index 0000000..6b331c4
--- /dev/null
+++ b/doc/src/snippets/declarative/createQmlObject.qml
@@ -0,0 +1,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()
+}