QJSEngine and C++ classes instanciated from JavaScript
-
wrote on 8 Aug 2014, 14:27 last edited by
Hello,
with the old QtScript it was possible to define a JavaScript class which is based on a C++ class.
The code for this purpose on C++ was
@
QScriptValue ctor = engine->newFunction(constructor);
QScriptValue myScriptClass = engine->newQMetaObject(&QObject::staticMetaObject, ctor);
engine.globalObject().setProperty("MyClass", myScriptClass);
@Then it was possible to write in JavaScript
@var x = new MyClass();@How can this be achieved with the new QJSEngine?
Best regards,
Nico
1/1