aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-05-08 11:41:28 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-09 00:56:16 +0200
commit3b04bbde6356797368114fce1b45b85271e9fed8 (patch)
tree05147265a236c1e6966c7385a97cdbc5e09ed68b
parente7b5ab4a57c8a0177384d31b836219248f0309d5 (diff)
Add documentation/links for incubateObject
Change-Id: I0ba05f513c6e11451b49848eb69e4b579e75f9a4 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
-rw-r--r--doc/src/qml/dynamicobjects.qdoc6
-rw-r--r--src/qml/qml/qqmlcomponent.cpp9
-rw-r--r--src/quick/items/qquickloader.cpp5
3 files changed, 17 insertions, 3 deletions
diff --git a/doc/src/qml/dynamicobjects.qdoc b/doc/src/qml/dynamicobjects.qdoc
index 2886d5b28a..55f131e6bd 100644
--- a/doc/src/qml/dynamicobjects.qdoc
+++ b/doc/src/qml/dynamicobjects.qdoc
@@ -118,6 +118,9 @@ use the signal \c connect() method. See
\l{QML Signal and Handler Event System#Connecting Signals to Methods and Signals}
{Connecting Signals to Methods and Signals} for more information.
+It is also possible to instantiate components without blocking via the
+\l {Component::incubateObject()}{incubateObject()} function.
+
\section2 Creating an Object from a String of QML
@@ -149,7 +152,8 @@ The actual creation context depends on how an item is created:
\li If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
if called, the creation context is the context of the parent item passed to this method
\li If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()}
- is called on that item, the creation context is the context in which the \c Component is defined
+ or \l {Component::incubateObject()}{incubateObject()} is called on that item,
+ the creation context 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
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index e5c498a662..e904188d4f 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1075,6 +1075,8 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent)
Dynamically created instances can be deleted with the \c destroy() method.
See \l {Dynamic Object Management in QML} for more information.
+
+ \sa incubateObject()
*/
void QQmlComponent::createObject(QQmlV8Function *args)
{
@@ -1137,7 +1139,7 @@ void QQmlComponent::createObject(QQmlV8Function *args)
}
/*!
- \qmlmethod object Component::incubateObject(Item parent, object properties, enum mode)
+ \qmlmethod object Component::incubateObject(Item parent, object properties, enumeration mode)
Creates an incubator for instance of this component. Incubators allow new component
instances to be instantiated asynchronously and not cause freezes in the UI.
@@ -1185,6 +1187,11 @@ void QQmlComponent::createObject(QQmlV8Function *args)
print ("Object", incubator.object, "is ready immediately!");
}
\endjs
+
+ Dynamically created instances can be deleted with the \c destroy() method.
+ See \l {Dynamic Object Management in QML} for more information.
+
+ \sa createObject()
*/
void QQmlComponent::incubateObject(QQmlV8Function *args)
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 864e03bf43..54e426098d 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -161,7 +161,10 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
\brief The Loader item allows dynamically loading an Item-based
subtree from a URL or Component.
- Loader is used to dynamically load visual QML components. It can load a
+ Loader is used to dynamically load visual QML components. For loading non-visual
+ components, see \l {Dynamic Object Management in QML}.
+
+ Loader can load a
QML file (using the \l source property) or a \l Component object (using
the \l sourceComponent property). It is useful for delaying the creation
of a component until it is required: for example, when a component should