Qt for WebAssembly: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Known issues - add more fine print)
m (Update QTBUG-65198 link text after having updated link target)
Line 43: Line 43:
* Qt renderes application content to a canvas element, and does not use (other) )native DOM elements. This means accessibility (screen readers) are not supported and that text inputs won't trigger virtual keyboards.
* Qt renderes application content to a canvas element, and does not use (other) )native DOM elements. This means accessibility (screen readers) are not supported and that text inputs won't trigger virtual keyboards.


You can find a full list of known issues here: [https://bugreports.qt.io/browse/QTBUG-65198 https://bugreports.qt.io/browse/QTBUG-63917]
You can find a full list of known issues here: [https://bugreports.qt.io/browse/QTBUG-65198 https://bugreports.qt.io/browse/QTBUG-65198]

Revision as of 10:59, 30 April 2018

Qt for WebAssembly makes it possible to build Qt applications as WebAssembly modules in order to target Web browsers.

Qt for WebAssembly is currently in development. A tech preview release is scheduled for release with Qt 5.11.

This Wiki page is also a work in progress, please see the development tracking bug for more information: https://bugreports.qt.io/browse/QTBUG-63917

Getting the code

The sources can be downloaded from your Qt Account, in the Downloads section. For the latest revision of the code, you can also check it out from our git repositories directly:

qtbase branch: wip/webassembly ( git clone -b wip/webassembly https://code.qt.io/qt/qtbase.git )

qtdeclarative branch: wip/webassembly ( git clone -b wip/webassembly https://code.qt.io/qt/qtdeclarative.git )

Other repositories should use the "5.11" branch to be compatible.

Building Qt

Requirements: Emscripten (known-good version: 1.37.33)

Supported host dev platforms: linux, macOS (Windows is not currently supported)

./configure -xplatform emscripten -confirm-license -opensource -developer-build -release -static -no-thread -nomake tests -nomake examples  -no-dbus -no-headersclean -no-feature-networkinterface  -system-libpng -no-ssl -no-warnings-are-errors

make

Building and running applications

/path/to/qmake && make

Start a web server (e.g. "python -m SimpleHTTPServer"), open e.g. localhost:8000/appname.html in a web browser. We test on Chrome, Firefox, and Safari (all desktop). Firefox (nightly) currently has the most performant wasm compiler, and is recommended for dev work.

You can also use:

/path/to/emscripten/emrun --browser=firefox appname.html

Note: If you are using Firefox, you can use CTRL+SHIFT+K to open the debug console.

Known issues - 5.11 Tech Preview Beta

  • Qt Quick will currently use the "software" backend, which will affect performance for complicated UIs and also disable the use of shader effects. A fix for this is coming soon.
Known issues and platform notes
  • It is not currently possible to use Windows as a host platform, but you can use the Windows Subsystem for Linux.
  • Due to disabled threading support in WebAssembly at the moment, the configure string above will build Qt with no threading support. If your application relies on threading, this may lead to unexpected effects.
  • Nested event loops are not supported. Applications should not call e.g. QDialog::exec() or create a new QEventLoop object.
  • Applications do not have access to system fonts. Font files must be distributed with the application, for example in Qt resources. Qt for WebAssembly itself embeds one such font.
  • Qt renderes application content to a canvas element, and does not use (other) )native DOM elements. This means accessibility (screen readers) are not supported and that text inputs won't trigger virtual keyboards.

You can find a full list of known issues here: https://bugreports.qt.io/browse/QTBUG-65198