I use C ++ to code most of my programming logic. I like to expose C ++ classes in QML so that QML can use JS to do many complex tasks. However, there is a problem:
If a C ++ function returns a QObject*
Q_INVOKABLE QObject* parseJson(const QString& someArguments)
{
return new SomeClassExtendsQObject(someArguments);
}
which is then assigned to a variable JSand used
var result = exposingCppObj.parseJson("I'm Arguments");
result.someMemberFunction(...);
.....
if i use
delete result
in QML JS, is the instance really freed, as it would be in C ++?
source
share