From bf1f17364f6c1f548715acf69023f511492682f3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 6 Jun 2018 10:10:53 +0200 Subject: [PATCH] Add note about calling invokable functions from QML when returning QObjects Link to the data ownership section of the QML documentation to elaborate on the special rules that apply for invokable functions that return QObjects. Change-Id: I41ea9089468c9505807cf1fde22be759b397a6d3 Reviewed-by: Mitch Curtis Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 6181bd579e..3717d7a19e 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4533,6 +4533,11 @@ QDebug operator<<(QDebug dbg, const QObject *o) invoked using QMetaObject::invokeMethod(). Since \c normalMethod() function is not registered in this way, it cannot be invoked using QMetaObject::invokeMethod(). + + If an invokable member function returns a pointer to a QObject or a + subclass of QObject and it is invoked from QML, special ownership rules + apply. See \l{qtqml-cppintegration-data.html}{Data Type Conversion Between QML and C++} + for more information. */ /*!