Transition from QtScript to QML/QJSEngine

880 views Asked by At

There is some platform with use of QtScript as the JavaScript interpreter for the description of logic of the application.

Example of a script on JS

var f=new File('/var/www/test1');
f.write('123\n');
f.CopyTo('/var/www/test2');

Object of File is described as

class File : public QObject, QScriptable  {
Q_OBJECT
 .. .
}

and such objects more than 10 it is described in a platform, a lot of logic is put in their constructor / destructor, there is Q_INVOKABLE methods which are called in a JS code.

Question: whether it is possible to transfer all this to QJSEngine having saved syntax of a JS code (it it is already much written)?

looked for responses to stackoverflow

Dynamic c++ object in QJSEngine

suggest to do through factory, but it will strongly worsen readability of a JS code and it should be rewritten

0

There are 0 answers