summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp4
2 files changed, 9 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 3b782e7..7aa17e8 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -549,15 +549,19 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
Returns an object instance from this component, or null if object creation fails.
The object will be created in the same context as the one in which the component
- was created.
+ was created. This function will always return null when called on components
+ which were not created in QML.
Note that if the returned object is to be displayed, its \c parent must be set to
- an existing item in a scene, or else the object will not be visible.
+ an existing item in a scene, or else the object will not be visible. The parent
+ argument is required to help you avoid this, you must explicitly pass in null if
+ you wish to create an object without setting a parent.
*/
/*!
\internal
- A version of create which returns a scriptObject, for use in script
+ A version of create which returns a scriptObject, for use in script.
+ This function will only work on components created in QML.
Sets graphics object parent because forgetting to do this is a frequent
and serious problem.
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index df9aa59..a7384a9 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1049,9 +1049,9 @@ If you are certain the files will be local, you could simplify to:
\snippet doc/src/snippets/declarative/componentCreation.js 2
-The methods and properties of the Component element are defined in its own
+The methods and properties of the \l {Component} element are defined in its own
page, but when using it dynamically only two methods are usually used.
-\c Component.createObject() returns the created object or \c null if there is an error.
+ \l {Component::createObject()}{Component.createObject()} returns the created object or \c null if there is an error.
If there is an error, \l {Component::errorString()}{Component.errorString()} describes
the error that occurred. Note that createObject() takes exactly one argument, which is set
to the parent of the created object. Graphical objects without a parent will not appear