diff options
Diffstat (limited to 'doc/src/qml/dynamicobjects.qdoc')
-rw-r--r-- | doc/src/qml/dynamicobjects.qdoc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/doc/src/qml/dynamicobjects.qdoc b/doc/src/qml/dynamicobjects.qdoc index e3d9adb49a..c50f9dd337 100644 --- a/doc/src/qml/dynamicobjects.qdoc +++ b/doc/src/qml/dynamicobjects.qdoc @@ -80,31 +80,31 @@ the component. This function can take one or two arguments: Here is an example. First there is \c Sprite.qml, which defines a simple QML component: -\snippet doc/src/snippets/declarative/Sprite.qml 0 +\snippet doc/src/snippets/qml/Sprite.qml 0 Our main application file, \c main.qml, imports a \c componentCreation.js JavaScript file that will create \c Sprite objects: -\snippet doc/src/snippets/declarative/createComponent.qml 0 +\snippet doc/src/snippets/qml/createComponent.qml 0 Here is \c componentCreation.js. Notice it checks whether the component \l{Component::status}{status} is \c Component.Ready before calling \l {Component::createObject()}{createObject()} in case the QML file is loaded over a network and thus is not ready immediately. -\snippet doc/src/snippets/declarative/componentCreation.js vars +\snippet doc/src/snippets/qml/componentCreation.js vars \codeline -\snippet doc/src/snippets/declarative/componentCreation.js func -\snippet doc/src/snippets/declarative/componentCreation.js remote -\snippet doc/src/snippets/declarative/componentCreation.js func-end +\snippet doc/src/snippets/qml/componentCreation.js func +\snippet doc/src/snippets/qml/componentCreation.js remote +\snippet doc/src/snippets/qml/componentCreation.js func-end \codeline -\snippet doc/src/snippets/declarative/componentCreation.js finishCreation +\snippet doc/src/snippets/qml/componentCreation.js finishCreation If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation() function and call \l {Component::createObject()}{createObject()} immediately: -\snippet doc/src/snippets/declarative/componentCreation.js func -\snippet doc/src/snippets/declarative/componentCreation.js local -\snippet doc/src/snippets/declarative/componentCreation.js func-end +\snippet doc/src/snippets/qml/componentCreation.js func +\snippet doc/src/snippets/qml/componentCreation.js local +\snippet doc/src/snippets/qml/componentCreation.js func-end Notice in both instances, \l {Component::createObject()}{createObject()} is called with \c appWindow passed as an argument so that the created object will become a child of the @@ -124,7 +124,7 @@ use the signal \c connect() method. See If the QML is not defined until runtime, you can create a QML item from a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example: -\snippet doc/src/snippets/declarative/createQmlObject.qml 0 +\snippet doc/src/snippets/qml/createQmlObject.qml 0 The first argument is the string of QML to create. Just like in a new file, you will need to import any types you wish to use. The second argument is the parent item for the new item; @@ -145,7 +145,7 @@ The actual creation context depends on how an item is created: \list \o If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the creation context - is the QDeclarativeContext in which this method is called + is the QQmlContext in which this method is called \o If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} if called, the creation context is the context of the parent item passed to this method \o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()} @@ -181,8 +181,8 @@ component. Each instance runs a NumberAnimation, and when the animation has fini \o \c SelfDestroyingRect.qml \row -\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0 -\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0 +\o \snippet doc/src/snippets/qml/dynamicObjects-destroy.qml 0 +\o \snippet doc/src/snippets/qml/SelfDestroyingRect.qml 0 \endtable @@ -209,6 +209,6 @@ destroyed if they were dynamically created. Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} can similarly be destroyed using \c destroy(): -\snippet doc/src/snippets/declarative/createQmlObject.qml 0 -\snippet doc/src/snippets/declarative/createQmlObject.qml destroy +\snippet doc/src/snippets/qml/createQmlObject.qml 0 +\snippet doc/src/snippets/qml/createQmlObject.qml destroy */ |