diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-30 05:26:55 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-30 05:27:24 (GMT) |
commit | 77cddec6ea642b073d1d9c017c865e740c0c60bc (patch) | |
tree | 6d14cf0504e956777a7016aa5ae05998ccd1ee7d /doc/src/snippets/declarative/componentCreation.js | |
parent | e900d3b5c026ede908a5b8623f044fff6421fdeb (diff) | |
download | Qt-77cddec6ea642b073d1d9c017c865e740c0c60bc.zip Qt-77cddec6ea642b073d1d9c017c865e740c0c60bc.tar.gz Qt-77cddec6ea642b073d1d9c017c865e740c0c60bc.tar.bz2 |
Doc fixes
Diffstat (limited to 'doc/src/snippets/declarative/componentCreation.js')
-rw-r--r-- | doc/src/snippets/declarative/componentCreation.js | 48 |
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] |