From f8b02638aac881619442423b0e633740cc39ecf2 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 15:57:14 +1000 Subject: Doc fixes --- doc/src/declarative/dynamicobjects.qdoc | 16 ++++++---------- doc/src/declarative/modules.qdoc | 2 +- doc/src/declarative/qdeclarativemodels.qdoc | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 63f697d..4cb5198 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -62,15 +62,11 @@ item which you want to manage dynamic instances of, and creating an item from a string of QML is intended for when the QML itself is generated at runtime. If you have a component specified in a QML file, you can dynamically load it with -the createComponent function on the \l{QML Global Object}. +the \l {createComponent(url file)}{createComponent()} function on the \l{QML Global Object}. 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. -You can also create a component by placing your QML inside a Component element. -Referencing that component element by id will be the same as referencing the variable -which you save the result of createComponent into. - -Once you have a component you can use its createObject method to create an instance of +Once you have a component you can use its \c createObject() method to create an instance of the component. Example QML script is below. Remember that QML files that might be loaded over the network cannot be expected to be ready immediately. \code @@ -116,10 +112,10 @@ the component. Example QML script is below. Remember that QML files that might b After creating the item, remember to set its parent to an item within the scene. Otherwise your dynamically created item will not appear in the scene. When using files with relative paths, the path should -be relative to the file where createComponent is executed. +be relative to the file where \c createComponent() is executed. If the QML does not exist until runtime, you can create a QML item from -a string of QML using the createQmlObject function, as in the following example: +a string of QML using the \l{createQmlObject(string qml, object parent, string filepath)}{createQmlObject()} function, as in the following example: \code newObject = createQmlObject('import Qt 4.7; Rectangle { color: "red"; width: 20; height: 20 }', @@ -139,9 +135,9 @@ will 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 createComponent +created item. The creation context is the QDeclarativeContext in which \c createComponent() was called, or the context in which the Component element, or the item used as the -second argument to createQmlObject, was specified. If the creation +second argument to \c createQmlObject(), was specified. If the creation context is destroyed before the dynamic item is, then bindings in the dynamic item will fail to work. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 0e332d4..0c69930 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -158,7 +158,7 @@ To import a module into a namespace: import Qt 4.7 as TheQtLibrary \endcode -Types from Qt 4.6 may then be used, but only by qualifying them with the namespace: +Types from the Qt 4.7 module may then be used, but only by qualifying them with the namespace: \code TheQtLibrary.Rectangle { ... } diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 5fd2799..d8b2a5d 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -54,7 +54,7 @@ delegate may bind to. The roles are exposed as properties of the \e model context property, though this property is set as a default property of the delegate so, unless there is a naming clash with a property in the delegate, the roles are usually accessed unqualified. The -example below would have a clash between he \e color role of the model and +example below would have a clash between the \e color role of the model and the \e color property of the Rectangle. The clash is avoided by referencing the \e color property of the model by its full name: \e model.color. -- cgit v0.12