Ok, mine is not exactly the same problem.
I had exposed a instance of a class that inherits QObject, ClsUserManager:
engine.globalObject().setProperty("UserManager",engine.newQObject(UserManager));
engine.globalObject().setProperty("UserManager",engine.newQObject(UserManager));
To copy to clipboard, switch view to plain text mode
UserManager has this public slot:
OtherCustomClass
* getUser
(QString id
);
OtherCustomClass* getUser(QString id);
To copy to clipboard, switch view to plain text mode
OtherCustomClass has a slot:
void setProperty(QString p)
To copy to clipboard, switch view to plain text mode
I tried to call de slot from my script:
UserManager.getUser(id).setProperty(p);
UserManager.getUser(id).setProperty(p);
To copy to clipboard, switch view to plain text mode
I get:
Debug: "TypeError: cannot call getUser(): unknown return type `OtherCustomClass*' (register the type with qScriptRegisterMetaType())"
Debug: "TypeError: cannot call getUser(): unknown return type `OtherCustomClass*' (register the type with qScriptRegisterMetaType())"
To copy to clipboard, switch view to plain text mode
The problem is that I can't call qScriptRegisterMetaType() from OtherCustomClass, it gets "QScriptEngine * engine" as first param, and I created some instances of QScriptEngine (by demmand) dinamically.
Regards
Bookmarks