Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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?
lgeyer last edited by
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.
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.