QScriptEngine vs. QJSEngine?



  • I am working on an internal windows desktop application/tool and I want to make it scriptable. It looks like currently there are at least two ways in Qt to do this. The scripts generated by users will be simple, and I will need to inject custom objects into the scripting environment for the user to manipulate.

    Both engines seem to do the same thing, except that QScriptEngine has the QScriptEngineAgent which might let me add a script debugging feature to the system.

    On the other hand, the documentation for QScriptEngine says that Qt Commercial users must honor the LGPL for it. We are using Digia's version, so does that mean I should avoid QScriptEngine?



  • QScriptEngine uses JavaScriptCore, which is LGPL (QJSEngine uses V8, which is BSD).

    So I assume that this passage tells you that even if you are a commercial customer, which allows you to release your code related to Qt under any license, you still will have to release code related to QScriptEngine - as it uses JavaScriptCore - under the terms of the LGPL


  • Moderators

    QScriptEngine is the old boy from Qt4. QJSEngine is based on v8 -(that's where the LGPL requirement comes from)- and was introduced in Qt5.

    No need to avoid it, as long as you don't break LGPL (you need to take a closer look at the license yourself, but in short it means you should not link that code statically + you have to publish any changes you make to that code. Your app can have any license you wish).



  • If I never actually ship/release code with scripting support, does it matter which one I use? (this is an internal tool)



  • Ok, so I may use either in this case. I still don't know how to figure out which one makes more sense for my application, they both seem to be the same thing to me.


  • Moderators

    I would say QJSEngine, if it has all that you need. Being based on v8 is a huge advantage in performance. AFAIK it does lack some of the convenience APIs QScriptEngine has.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.