aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/doc')
-rw-r--r--src/qml/doc/snippets/qml/createQmlObject.qml15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qml/doc/snippets/qml/createQmlObject.qml b/src/qml/doc/snippets/qml/createQmlObject.qml
index 8a082a71de..bfb1d98ca8 100644
--- a/src/qml/doc/snippets/qml/createQmlObject.qml
+++ b/src/qml/doc/snippets/qml/createQmlObject.qml
@@ -58,9 +58,18 @@ Rectangle {
function createIt() {
//![0]
-var newObject = Qt.createQmlObject('import QtQuick 2.0; Rectangle {color: "red"; width: 20; height: 20}',
- parentItem,
- "dynamicSnippet1");
+const newObject = Qt.createQmlObject(`
+ import QtQuick 2.0
+
+ Rectangle {
+ color: "red"
+ width: 20
+ height: 20
+ }
+ `,
+ parentItem,
+ "myDynamicSnippet"
+);
//![0]
//![destroy]