Changes to Qt WebEngine
Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use.
We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework
In this topic we summarize those changes in Qt WebEngine, and provide guidance to handle them.
The Qt WebEngine module
Has been renamed to the Qt WebEngineQuick module to not collide with the name of the super module, and to be consistent with other Quick modules.
If you port your Qt Quick application, please remember to use the new module name in your qmake project file.
QT += webenginequick
Classes moved from Qt WebEngineWidgets to Qt WebEngineCore
Several classes have been moved from Qt WebEngineWidgets to Qt WebEngineCore if they did not use the Widgets module. In most cases this change should be source compatible unless you included the module name in the include header, in which case you need to update your includes.
Classes moved with minimal changes
Has been unified between QML and C++ versions, so both are now accepted or rejected via methods on the class.
Has been moved to Core and renamed QWebEngineContextMenuRequest.
Has been moved to Core and renamed QWebEngineDownloadRequest.
Has been moved to Core, and API that worked on QWebEngineView or QPrinter has been moved, and can now be accessed only from QWebEngineView. See Changed API.
Classes moved from Qt WebEngineQuick to Qt WebEngineCore
Is now QWebEngineNavigationRequest, and accessible from C++ API as well, adding a more informative variant of QWebEnginePage::acceptNavigationRequest().
Is now WebEngineNewWindowRequest and QWebEngineNewWindowRequest, and accessible from C++ API as well, adding a more informative variant of QWebEnginePage::createWindow().
Is now a signal instead of a derived method. The errors are either accepted or rejected via methods on the QWebEngineCertificateError class.
Has been moved to QWebEngineView::print() and no longer takes a callback argument but signals finished with QWebEngineView::printFinished() instead. It was never possible to have two active print jobs at the same time.
Has been removed as QWebEnginePage and QWebEngineView are now in different modules. The view associated with a page can be accessed using the static helper QWebEngineView::forPage().
Has been removed. The default profile is now an off-the-record profile, and only used if a QWebEnginePage is created without an explicit profile. To maintain Qt 5 like behavior, create a global profile called "Default" and use it when creating every QWebEnginePage.
The navigation requests are now accepted or rejected like other request objects using accept() or reject() methods.
Has been renamed WebEngineNewWindowRequest.
The default profile is now off the record. To have a standard browser profile with disk-cache and cookies, we recommend creating your own profile and using that explicitly.
Can no longer be accessed from custom schemes by default, nor can it access local content directly. If the Qt 5 behavior is needed, it can be restored by registering the qrc scheme like a custom URL scheme, and setting the CorsEnabled and LocalAccessAllowed access flags.
QWebEngineUrlScheme qrcScheme(QByteArrayLiteral("qrc")); qrcScheme.setFlags(QWebEngineUrlScheme::SecureScheme | QWebEngineUrlScheme::LocalAccessAllowed | QWebEngineUrlScheme::CorsEnabled | QWebEngineUrlScheme::ViewSourceAllowed); QWebEngineUrlScheme::registerScheme(qrcScheme);
OCSP Certificate Revocation Checking
In Qt 5 OCSP could be enabled on Linux using QWebEngineProfile::setUseForGlobalCertificateVerification(true) on a QWebEngineProfile. This has been removed in Qt6 as this specific form of OCSP is considered bad. As of Qt 6.2, no new method for revoked certificate checking on Linux has yet been added.
© 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.