Can references or pointers be used in C++ methods called from QML/JavaScript?
-
Can references (or possibly pointers) be used when a C++ method is called from a JavaScript function in QML or can only values be used? For example, my code works when I have
@
MyClass{
id: myclass
}function mytest(){
myclass.test(["Value1", "Value2", "Value3"]);
}
@in a QML file and
@
Q_INVOKABLE void test(QList<QString> arg);
@in MyClass.h (with corresponding code in MyClass.cpp)
but it generates an error when I use &arg or *arg.
Must the return type of a C++ method also be a value or can references or pointers be used?
-
You can use pointers to QObjects. I don't think any other would work, apart from standard const references (const QString &blah).