From 1867868fee63d19fc61d5dde9c36e91dbb918a64 Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Tue, 14 Aug 2012 11:08:33 +0200 Subject: [PATCH] Doc: Clarify ownership semantics of objects returned by property getters Change-Id: I8d19756e95ff02ed67b39ba4741aff4fda5896ce Reviewed-by: Chris Adams --- src/qml/qml/qqmlengine.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index be20708..1a9fc58 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1082,8 +1082,10 @@ void QQmlEngine::setContextForObject(QObject *object, QQmlContext *context) have been transferred to the C++ caller. Objects not-created by QML have CppOwnership by default. The - exception to this is objects returned from a C++ method call. The - ownership of these objects is passed to JavaScript. + exception to this is objects returned from C++ method calls; in these cases, + the ownership of the returned objects will be set to JavaScriptOwnerShip. + Note this applies only to explicit invocations of Q_INVOKABLE methods or slots, + and not to property getter invocations. Calling setObjectOwnership() overrides the default ownership heuristic used by QML. -- 1.7.2.5