summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/snippets/declarative')
-rw-r--r--doc/src/snippets/declarative/componentCreation.js48
1 files changed, 21 insertions, 27 deletions
diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
index 814545e..be928f0 100644
--- a/doc/src/snippets/declarative/componentCreation.js
+++ b/doc/src/snippets/declarative/componentCreation.js
@@ -20,38 +20,32 @@ function finishCreation() {
}
//![0]
-//![1]
function createSpriteObjects() {
-//![1]
-
- //![2]
- component = Qt.createComponent("Sprite.qml");
- if (component.status == Component.Ready)
- finishCreation();
- else
- component.statusChanged.connect(finishCreation);
- //![2]
- //![3]
- component = Qt.createComponent("Sprite.qml");
- sprite = component.createObject();
+//![1]
+component = Qt.createComponent("Sprite.qml");
+if (component.status == Component.Ready)
+ finishCreation();
+else
+ component.statusChanged.connect(finishCreation);
+//![1]
- if (sprite == null) {
- // Error Handling
- console.log("Error loading component:", component.errorsString());
- } else {
- sprite.parent = appWindow;
- sprite.x = 100;
- sprite.y = 100;
- // ...
- }
- //![3]
+//![2]
+component = Qt.createComponent("Sprite.qml");
+sprite = component.createObject();
+
+if (sprite == null) {
+ // Error Handling
+ console.log("Error loading component:", component.errorsString());
+} else {
+ sprite.parent = appWindow;
+ sprite.x = 100;
+ sprite.y = 100;
+ // ...
+}
+//![2]
-//![4]
}
-//![4]
-//![5]
createSpriteObjects();
-//![5]