Doc: Clarify object ownership of QObject* returned by QmlComponent::create
authorKai Koehne <kai.koehne@digia.com>
Thu, 6 Jun 2013 13:18:57 +0000 (15:18 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 7 Jun 2013 08:24:06 +0000 (10:24 +0200)
Link to relevant section in QQmlEngine::ObjectOwnership. It's a big gotcha
that a QObject * returned by a Qt method won't be deleted eventually, by
default.

Change-Id: I2367b7ae2673adc7fa181b759c79683091020462
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Alan Alpert <aalpert@blackberry.com>

src/qml/qml/qqmlcomponent.cpp

index ccef0a6..1fa1c23 100644 (file)
@@ -767,6 +767,11 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent)
 
     If \a context is 0 (the default), it will create the instance in the
     engine' s \l {QQmlEngine::rootContext()}{root context}.
+
+    The ownership of the returned object instance is determined by the QQmlEngine.
+    By default the caller has to take care that the object is eventually deleted.
+
+    \sa QQmlEngine::ObjectOwnership
 */
 QObject *QQmlComponent::create(QQmlContext *context)
 {
@@ -805,7 +810,10 @@ QObject *QQmlComponent::create(QQmlContext *context)
     communicate information to an instantiated component, as it allows their
     initial values to be configured before property bindings take effect.
 
-    \sa completeCreate()
+    The ownership of the returned object instance is determined by the QQmlEngine.
+    By default the caller has to take care that the object is eventually deleted.
+
+    \sa completeCreate(), QQmlEngine::ObjectOwnership
 */
 QObject *QQmlComponent::beginCreate(QQmlContext *publicContext)
 {