The code for this purpose on C++ was
QScriptValue ctor = engine->newFunction(constructor);
QScriptValue myScriptClass = engine->newQMetaObject(&QObject::staticMetaObject, ctor);
@var x = new MyClass();@
How can this be achieved with the new QJSEngine?