Diffrences between Q_PROPERTY and Q_INVOKABLE
-
What exactly (other than whats obvious) is the difference between a
Q_PROPERTY
and aQ_INVOKABLE
?Specifically, this doc states:
"Objects not-created by QML have CppOwnership by default. The exception to this are objects returned from C++ method calls; their ownership will be set to JavaScriptOwnership. This applies only to explicit invocations of Q_INVOKABLE methods or slots, but not to property getter invocations."
Whereas in contrast this document states:
"When data is transferred from C++ to QML, the ownership of the data always remains with C++. The exception to this rule is when a QObject is returned from an explicit C++ method call: in this case, the QML engine assumes ownership of the object, unless the ownership of the object has explicitly been set to remain with C++ by invoking QQmlEngine::setObjectOwnership() with QQmlEngine::CppOwnership specified."
Which seems to suggjest that both Q_PROPERTY and Q_INVOKABLE share this potential problem of QML taking ownership where it shouldn't.