Important: Please read the Qt Code of Conduct -

New C++-JS-Types with constructor for QML's QtScript

  • Hi,

    for QScriptEngines it is possible to create C++ functions that you can use as constructors in javascript using @QScriptEngine::newFunction ( FunctionSignature fun, const QScriptValue & prototype, int length = 0 )@
    and then you can call
    @ var myObj = new CPPConstructor() @

    Is it possible to do the same for QML?
    QDeclarativeEngine just allows you to create new QML types, but I don't see how to add new javascript types.



  • Hi,

    Unfortunately this isn't currently possible. is probably the most relevant suggestion to track in regards to this.


Log in to reply