Qt WebView lets you display web content inside a QML application. To avoid including a full web browser stack, Qt WebView uses native APIs where appropriate.
This is useful on mobile platforms, such as Android and iOS. On iOS, policies dictate that all web content is displayed using the operating system's web view.
On Windows and Linux, Qt WebView depends on the Qt WebEngine module to render content.
On macOS, the system web view is used in the same manner as iOS.
To make the Qt WebView module function correctly across all platforms, it's necessary to call QtWebView::initialize()
before creating the QGuiApplication
instance and before window's QPlatformOpenGLContext
is created.
The QML types of the module are available through the QtWebView
import. To use the types, add the following import statement to your .qml file:
import QtWebView
Using a Qt module requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.
Use the find_package()
command to locate the needed module component in the Qt6
package:
find_package(Qt6 REQUIRED COMPONENTS WebView)
target_link_libraries(mytarget PRIVATE Qt6::WebView)
For more details, see the Build with CMake overview.
To configure the module for building with qmake, add the module as a value of the QT
variable in the project's .pro file:
QT += webview
Due to platform limitations, overlapping the WebView with other QML components is not supported. Doing this will have unpredictable results, which may differ from platform to platform.
Look at the Qt WebView Examples for a demonstration on how the APIs can be used in applications.
Qt WebView is available under commercial licenses from The Qt Company. In addition, it is available under the GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: