Qt WebAssembly Q&A, Part 1

WebAssembly is a bytecode representation that is meant to be targeted by high-level programming languages such as C++ and to be executed inside a virtual machine in a browser. It will change the way you design your embedded devices, applications, and other software. Qt for WebAssembly allows you to run your C++ applications on popular web browsers, such as Google Chrome and Mozilla Firefox – and our efforts to support more browsers are continuous.

Want to find out more about WebAssembly but don't know what to ask? We quizzed our Senior Product Manager, Veli-Pekka Heinonen, with 11 burning questions sent to us by our dev community. This will be an ongoing series, so do not hesitate to send us your questions for our next edition!

 

1. Will WebAssembly support the SQL module?

VP: SQLite is currently supported, being part of the QtSQL module. 

 

2. What licence will Qt WebAssembly require in the Qt 6 Lifecycle? 

VP: The WebAssembly platform adaptation is licensed under both GPLv3 and Commercial licenses. In other words, it is available for both open source and commercial customers. There are currently no plans to change this dual licensing model for WebAssembly. 

Having said that, it is good to remember that additional value-add commercial-only modules such as DesignViewer, or GPLv3 modules such as Qt Charts, are for commercial only, or GPLv3 on all supported platforms for the module, also in addition to WebAssembly.

 

3. When will Qt WebAssembly offer support for the iOS popup keyboard?

VP: Qt 6.4 has experimental support for the iOS keyboard, bit this feature has not been completed yet.

 

4. What is Qt doing to support development and deployment of secure WebAssembly applications, especially when accessing local hardware (e.g., audio)?

VP: The WebAssembly platform provides base security features such as JavaScript sandbox that sets limits to what a web app can do. On top of that, Qt has worked on features such as local file access, for more details please visit: https://doc.qt.io/qt-6/wasm.html.

 

5. Can a Qt Widget App be created in WebAssembly?

VP: It can, however, depending on the application requirements you may have to fine-tune some things to cater to the JavaScript sandbox and WebAssembly platform. Example areas to check are supported Qt modules , multithreading, networking and local file access. You can get a full view here: https://doc.qt.io/qt-6/wasm.html.

 

6. If our application uses other third-party libraries like VTK, ITK, and boost, how easy will the deployment process in WebAssembly be using Qt 6.4?

VP: Dynamic linking is not currently supported due to some platform limitations. However, work is ongoing to change that in upcoming versions. Static linking can already be used.

 

7. Should we activate QT_EMSCRIPTEN_ASYNCIFY, multithreading for WASM?

VP: Asyncify can be enabled if the application makes API calls which block the main thread, such as QDialog::exec(). Multithreading can be enabled if the application requires, or can benefit from using multiple threads in addition to the main thread.

 

8. Is it possible now (or will it be in the future) to use WebAssembly (including UI) without QML?

VP: Qt for WebAssembly also supports widgets that provide a wide variety of functionality for the UI, although on a lower level. Also, screen reader base support is available for widgets in the dev branch (not in 6.4) for people to utilize if needed.

 

9. Is WebAssembly fully supported in Qt 5.x?

VP: Qt 5.15 supports WebAssembly as a target, however, with some feature limitations that are being addressed in Qt 6. Professional services can be used to port features from Qt 6 to Qt 5.

 

10. Can the Qt for WebAssembly app have access to a web API browser storage like localstorage or indexedDB through JavaScript?

VP: File system access is sandboxed on the web, and this has implications for how the application works with files. The Web platform provides APIs for accessing the local file system in a way that is under user control, as well as APIs for accessing persistent storage. Emscripten and Qt wrap these features, and provide APIs which are easier to use from C++ and Qt-based applications.

More info here: https://doc.qt.io/qt-6/wasm.html.

 

11. Will Qt 6.4 support QOpenGLWidget in WebAssembly?

VP: Yes, QOpenGLWidget now works with Qt 6.4

 

Have more questions or want to learn more about WebAssembly?

Head on over to our WebAssembly Demos & Examples

 

 

 

 


Blog Topics:

Comments