QScript and visibility of QObjects
I'm trying to understand why the following class give me this behavior: @ class ToolFactory : public QObject
Q_INVOKABLE Tool* newTool_broken(QString name);
Q_INVOKABLE void newTool_working(QString name)
Tool* t = newTool_broken(name);
}@ Now from the QScript side,
if I call Factory.newTool_broken("myName"), it fails saying @Factory.newTool_broken("myName");
TypeError: cannot call newTool_broken(): unknown return type `Tool*' (register the type with qScriptRegisterMetaType())@ but if I call Factory.newTool_working("myName"), I can then use @Factory.myName
Tool(0xa042378, name = "myName") @
As stated in the error did you made Tool known to the Meta Object system using qScriptRegisterMetaType ?
No, and I don't want to do that because I can use my Tool* object using the "trick" in newTool_working() so the Meta Object seem to be aware of what a Tool* is.