Skip to main content

QtWS15- When all goes according to script Qt application development, Kevin Krammer, KDAB

When all goes according to script: Qt has had in-application scripting capabilities for a long time in the form of the QtScript module. With the deprecation of said module in Qt5.5, many have started looking for a successor. QJSEngine and, by extension, its variant QQmlEngine, mostly famous for being at the core of Qt's outstanding QML technology, are the most obvious candidates. While neither is a drop-in replacement of the now deprecated QtScriptEngine, they do provide a state-of-the-art JavaScript implementation, with a wide range of easy to use integration points. Being explicitly designed for use with Qt and its object and introspection system does not only allow them to easily and efficiently bridge between the C++ and JavaScript worlds, it also puts them into a special position when it comes to supported platforms. While other engines, like Google's famous V8, cannot be used on platforms with certain restrictions, such as Apple's iOS, Qt's new engine, lovingly code-named V4, remains fully portable and supported as these restrictions have been part of all design and implementation considerations. This talk will focus on how to use these new facilities and common techniques for integrating with the application's data and functionality. Special attentions will be drawn to how the capabilities inherent to the QML variant can make scripts even more versatile, elevating them from mere execution and computation helpers to powerful application add-ons. While QML is most well known for being the foundation for QtQuick based user interfaces, it offers great opportunities for scripts in applications using QtWidgets, or not having any UI at all.