From e4b865ef512e338cf495226dc98540f45fba1d9f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 30 Apr 2010 15:42:02 +1000 Subject: More doc fixes --- doc/src/declarative/dynamicobjects.qdoc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index c376266..5cdd768 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -68,7 +68,7 @@ the \l {Qt.createComponent(url file)}{Qt.createComponent()} function on the \l{Q This function takes the URL of the QML file as its only argument and returns a component object which can be used to create and load that QML file. -Once you have a component you can use its \c createObject() method to create an instance of +Once you have a component you can use its \l {Component::createObject()}{createObject()} method to create an instance of the component. Here is an example. Here is a \c Sprite.qml, which defines a simple QML component: @@ -123,19 +123,13 @@ The actual creation context depends on how an item is created: is the QDeclarativeContext in which this method is called \o If \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} if called, it is the context of the item used as the second argument to this method -\o If a \c {Component \{\}} item is defined and \c {Component::}{createObject()} is called, - it is the context in which the \c Component item is defined +\o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()} + is called on that item, it is the context in which the \c Component is defined +\endlist Also, note that while dynamically created objects may be used the same as other objects, they do not have an id in QML. -A restriction which you need to manage with dynamically created items, -is that the creation context must outlive the -created item. The creation context is the QDeclarativeContext in which \c Qt.createComponent() -was called, or the context in which the Component element, or the item used as the -second argument to \c Qt.createQmlObject(), was specified. If the creation -context is destroyed before the dynamic item is, then bindings in the dynamic item will -fail to work. \section1 Deleting Objects Dynamically You should generally avoid dynamically deleting objects that you did not -- cgit v0.12