Qt WebEngine Platform Notes
Building Qt WebEngine from Source
Static builds are not supported.
The requirements for building Qt 5 modules from source are listed separately for each supported platform:
In addition, the following tools are required for building the Qt WebEngine module:
The tests for skipping the Qt WebEngine build are located in the
qtwebengine repository, in the
tools\qmake\mkspecs subdirectory. They can be found by searching for
On all platforms, the following tools are required at build time:
- Python 2.7.5 or later. Python 3 is not supported.
- Bison, Flex
- Node.js version 8 or later (version 12 or later is recommended)
On Windows, the following additional tools are required:
- Visual Studio 2017 version 15.8 or later, or clang-cl version 8 or later
- Active Template Library (ATL), usually included in the Visual Studio installation
- Windows 10 SDK version 10.0.19041 or later
Qt WebEngine can only be built on 64-bit Windows, with a x64-bit toolchain. For building Qt WebEngine for x86 applications, you need to configure and compile Qt with the Visual Studio 2017 x64 to x86 cross-compile toolchain. This toolchain can be set up on the command line by running
On Linux, Clang or GCC version 5 or later is required. Supported configurations are
Qt WebEngine requires
pkg-config to detect most of its dependencies. The following
pkg-config files are required:
If Qt was configured for
xcb, the following
pkg-config files are also required:
Further, development packages for
libcap need to be installed.
On macOS, the following are required:
- macOS 10.13 or later
- Xcode 10.0 or later
- macOS 10.13 SDK or later
Note: Qt WebEngine cannot be built for the 32-bit mode of macOS (using the
Using Earlier Qt Versions to Build Qt WebEngine
Building Qt WebEngine with earlier Qt versions (down to the last LTS version) is supported. It means that Qt WebEngine 5.15 can be built with Qt 5.12.x, Qt 5.14.x, and Qt 5.15.
To use an earlier Qt version to build Qt Webengine:
- Download the qtwebengine sources.
- From the earlier Qt version, run
qmake && make (&& make install).
Mac App Store Compatibility
Applications using Qt WebEngine are not compatible with the Mac App Store, because:
- The Chromium part of the code uses several private API methods, which are prohibited by the App Store.
- Applications submitted to the App Store must be code-signed with the App Sandbox feature enabled. The App Sandbox feature interferes with Chromium's own sandbox initialization, which results in Chromium not being properly initialized. This also ties in with the private API usage. Furthermore, standalone Chromium itself is not officially tested with the App Sandbox enabled, and even if work is done to bypass the App Store's restrictions, that would not guarantee correct behavior of the library.
macOS Airplay Support on MacBooks with Dual GPUs
To make Qt WebEngine work correctly when streaming to an AppleTV from a MacBook that supports GPU switching, it is important to add the
NSSupportsAutomaticGraphicsSwitching option to the application Info.plist file, with the value set to
YES. Otherwise rendering issues might occur when creating new web engine view instances after Airplay is switched on or off.
Default QSurfaceFormat OpenGL Profile Support
If a new default QSurfaceFormat with a modified OpenGL profile has to be set, it should be set before the application instance is declared, to make sure that all created OpenGL contexts use the same OpenGL profile.
On macOS, if the default QSurfaceFormat is set after the application instance, the application will exit with qFatal(), and print a message that the default QSurfaceFormat should be set before the application instance.
Qt WebEngine provides out-of-the-box sandboxing support for Chromium render processes.
On Linux, note the following restrictions:
- The kernel has to support the anonymous namespaces feature (kernel version 3.8 or later). However, on Debian, Ubuntu, and other Debian-derived distributions, this feature is off by default. It can be turned on by setting
- The kernel has to support the
seccomp-bpffeature (kernel version 3.5 or later).
- Setuid sandboxes are not supported and are thus disabled.
To explicitly disable sandboxing, use one of the following options:
- Set the
QTWEBENGINE_DISABLE_SANDBOXenvironment variable to 1.
- Pass the
--no-sandboxcommand line argument to the user application executable.
For more information, see Using Command-Line Arguments.
Memory Requirements in Docker Environment
When running Qt Web Engine examples in a Docker container and browsing content-heavy sites, BUS errors (SIGBUS) might be reported. Typically, this is caused by Docker running a container with a too small memory space (such as 64MB). To fix this problem, increase the memory space size.
Accessibility and Performance
Qt WebEngine enables accessibility support for web pages when the following conditions are met:
- Qt Core is configured and built with accessibility support enabled.
- The QPA plugin is notified by the operating system that accessibility should be activated. This happens for example when using a screen reader application on Windows or VoiceOver on macOS.
Due to some limitations, the Linux QPA plugin almost always reports that accessibility should be activated. On big HTML pages, this can cause a significant slowdown in rendering speed.
Because of that, from Qt 5.9 onwards, Qt WebEngine accessibility support is disabled by default on Linux. It can be re-enabled by setting the
QTWEBENGINE_ENABLE_LINUX_ACCESSIBILITY environment variable to a non-empty value.
Popups in Fullscreen Applications on Windows
Because of a limitation in the Windows compositor, applications that show a fullscreen web engine view will not properly display popups or other top-level windows. The reason and workaround for the issue can be found at Fullscreen OpenGL Based Windows and QWindowsWindowFunctions::setHasBorderInFullScreen.
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.