Qt WebEngine QML Types
To link against the module using build with qmake, add the following QT variable to your qmake .pro file:
QT += webenginequick
For build with CMake use the find_package()
command to locate the needed module components in the Qt6 package and target_link_libraries()
to link against the module:
find_package(Qt6 REQUIRED COMPONENTS WebEngineQuick)
target_link_libraries(target PRIVATE Qt6::WebEngineQuick)
The minimal amount of code needed to load and display an HTML page using the QML engine requires a proper initialization:
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QtWebEngineQuick/qtwebenginequickglobal.h> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QtWebEngineQuick::initialize(); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec(); }
Where the content of main.qml is simply:
import QtQuick import QtQuick.Window import QtWebEngine Window { width: 1024 height: 750 visible: true WebEngineView { anchors.fill: parent url: "https://www.qt.io" } }
A request for providing authentication credentials required by proxies or HTTP servers | |
A request for selecting a color by the user | |
A request for showing a context menu | |
A request for letting the user choose a (new or existing) file or directory | |
A utility type for encapsulating the result of a string search on a page | |
A utility type for the WebEngineView::fullScreenRequested() signal | |
A request for showing an alert, a confirmation, or a prompt dialog from within JavaScript to the user | |
Type enables accepting or rejecting requests from the registerProtocolHandler API | |
A request for showing a tooltip to the user | |
A request for showing a touch selection menu | |
Provides access to the default settings and profiles shared by all web engine views | |
An action that represents a WebEngineView::WebAction | |
A utility type for ignoring certificate errors or rejecting erroneous certificates | |
Represents a client certificate option | |
Provides a selection of client certificates | |
Provides information about a download | |
Provides data models that represent the history of a web engine page | |
A data model that represents the history of a web engine page | |
A utility type for the WebEngineView::loadingChanged signal | |
Represents a request for navigating to a web page as part of WebEngineView::navigationRequested() | |
A utility type for the WebEngineView::newWindowRequested signal | |
Encapsulates the data of an HTML5 web notification | |
Contains settings, scripts, and visited links common to multiple web engine views | |
Enables the programmatic injection of scripts in the JavaScript engine | |
Manages a collection of user scripts | |
Allows configuration of browser properties and attributes | |
A WebEngineView renders web content within a QML application |
© 2024 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.