summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-01-14 00:51:53 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-01-14 00:51:53 (GMT)
commit5207e48e469e279fe20304914e92edd73c5c641f (patch)
tree4811668148d8b7016c4ae34d599d073d45882f6f /src
parent4f2538b2785e19f391ecdb9694970d3cae3c835f (diff)
downloadQt-5207e48e469e279fe20304914e92edd73c5c641f.zip
Qt-5207e48e469e279fe20304914e92edd73c5c641f.tar.gz
Qt-5207e48e469e279fe20304914e92edd73c5c641f.tar.bz2
Clarify Component.createObject(null) behavior.
Setting the parent of the returned item does not affect its object ownership so care must be taken to ensure it is not garbage collected. Task-number: QTBUG-16630 Reviewed-by: Aaron Kennedy
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index e2cbdcf..f716f85 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -627,6 +627,10 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
must provide a valid \a parent value or set the returned object's \l{Item::parent}{parent}
property, or else the object will not be visible.
+ If a \a parent is not provided to createObject(), a reference to the returned object must be held so that
+ it is not destroyed by the garbage collector. This is regardless of Item.parent being set afterwards,
+ since setting the Item parent does not change object ownership; only the graphical parent is changed.
+
Dynamically created instances can be deleted with the \c destroy() method.
See \l {Dynamic Object Management in QML} for more information.
*/