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.js8
-rw-r--r--doc/src/snippets/declarative/dynamicObjects.qml3
2 files changed, 3 insertions, 8 deletions
diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
index be928f0..f6fb379 100644
--- a/doc/src/snippets/declarative/componentCreation.js
+++ b/doc/src/snippets/declarative/componentCreation.js
@@ -4,11 +4,10 @@ var sprite;
function finishCreation() {
if (component.status == Component.Ready) {
- sprite = component.createObject();
+ sprite = component.createObject(appWindow);
if (sprite == null) {
// Error Handling
} else {
- sprite.parent = appWindow;
sprite.x = 100;
sprite.y = 100;
// ...
@@ -32,13 +31,12 @@ else
//![2]
component = Qt.createComponent("Sprite.qml");
-sprite = component.createObject();
+sprite = component.createObject(appWindow);
if (sprite == null) {
// Error Handling
console.log("Error loading component:", component.errorsString());
} else {
- sprite.parent = appWindow;
sprite.x = 100;
sprite.y = 100;
// ...
@@ -47,5 +45,3 @@ if (sprite == null) {
}
-createSpriteObjects();
-
diff --git a/doc/src/snippets/declarative/dynamicObjects.qml b/doc/src/snippets/declarative/dynamicObjects.qml
index dd55d78..6a8c927 100644
--- a/doc/src/snippets/declarative/dynamicObjects.qml
+++ b/doc/src/snippets/declarative/dynamicObjects.qml
@@ -21,8 +21,7 @@ Rectangle {
}
function createRectangle() {
- var object = rectComponent.createObject();
- object.parent = rootItem;
+ var object = rectComponent.createObject(rootItem);
}
Component.onCompleted: createRectangle()