summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/componentCreation.js
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-08-04 14:16:35 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-08-04 14:16:35 (GMT)
commit84fdd4be15a8fa2ea921a112a05b185ffd59cc04 (patch)
treedd4539a6f6eeccb05d02bce338b7f755504dcff6 /doc/src/snippets/declarative/componentCreation.js
parent245a68a0aad0473fcf56cd75e78b951480d39e2b (diff)
parentae1c9def5cb22d88cf10b2a23d06bc38da12725b (diff)
downloadQt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.zip
Qt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.tar.gz
Qt-84fdd4be15a8fa2ea921a112a05b185ffd59cc04.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'doc/src/snippets/declarative/componentCreation.js')
-rw-r--r--doc/src/snippets/declarative/componentCreation.js63
1 files changed, 34 insertions, 29 deletions
diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
index 25bc10c..c29a1f9 100644
--- a/doc/src/snippets/declarative/componentCreation.js
+++ b/doc/src/snippets/declarative/componentCreation.js
@@ -1,7 +1,39 @@
-//![0]
+//![vars]
var component;
var sprite;
+//![vars]
+//![func]
+function createSpriteObjects() {
+//![func]
+
+//![remote]
+ component = Qt.createComponent("Sprite.qml");
+ if (component.status == Component.Ready)
+ finishCreation();
+ else
+ component.statusChanged.connect(finishCreation);
+//![remote]
+
+//![local]
+ component = Qt.createComponent("Sprite.qml");
+ sprite = component.createObject(appWindow);
+
+ if (sprite == null) {
+ // Error Handling
+ console.log("Error creating object");
+ } else {
+ sprite.x = 100;
+ sprite.y = 100;
+ // ...
+ }
+//![local]
+
+//![func-end]
+}
+//![func-end]
+
+//![finishCreation]
function finishCreation() {
if (component.status == Component.Ready) {
sprite = component.createObject(appWindow);
@@ -17,31 +49,4 @@ function finishCreation() {
console.log("Error loading component:", component.errorString());
}
}
-//![0]
-
-function createSpriteObjects() {
-
-//![1]
-component = Qt.createComponent("Sprite.qml");
-if (component.status == Component.Ready)
- finishCreation();
-else
- component.statusChanged.connect(finishCreation);
-//![1]
-
-//![2]
-component = Qt.createComponent("Sprite.qml");
-sprite = component.createObject(appWindow);
-
-if (sprite == null) {
- // Error Handling
- console.log("Error loading component:", component.errorString());
-} else {
- sprite.x = 100;
- sprite.y = 100;
- // ...
-}
-//![2]
-
-}
-
+//![finishCreation]