- Qt 6.12
- Qt WebEngine
- Changes to Qt WebEngine
- Qt 6.12.0 Reference Documentation

Porting from Qt WebKit to Qt WebEngine ◦ Qt WebEngine Licensing

# 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.

## Moved Classes

### 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

- QWebEngineHistory
- QWebEngineProfile
- QWebEngineScript
- QWebEngineScriptCollection
- QWebEngineClientCertificateSelection
- QWebEngineSettings
- QWebEngineFullScreenRequest

#### QWebEngineCertificateError

Has been unified between QML and C++ versions, so both are now accepted or rejected via methods on the class.

#### QWebEngineContextMenuData

Has been moved to Core and renamed QWebEngineContextMenuRequest.

#### QWebEngineDownloadItem

Has been moved to Core and renamed QWebEngineDownloadRequest.

#### QWebEnginePage

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

#### WebEngineNavigationRequest

Is now QWebEngineNavigationRequest, and accessible from C++ API as well, adding a more informative variant of QWebEnginePage::acceptNavigationRequest().

#### WebEngineNewViewRequest

Is now WebEngineNewWindowRequest and QWebEngineNewWindowRequest, and accessible from C++ API as well, adding a more informative variant of QWebEnginePage::createWindow().

## Changed API

### C++

#### QWebEnginePage::certificateError()

Is now a signal instead of a derived method. The errors are either accepted or rejected via methods on the QWebEngineCertificateError class.

#### QWebEnginePage::print()

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.

#### QWebEnginePage::view()

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().

#### QWebEngineProfile::defaultProfile()

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.

### QML

#### WebEngineNavigationRequest

The navigation requests are now accepted or rejected like other request objects using accept() or reject() methods.

#### WebEngineNewViewRequest

Has been renamed WebEngineNewWindowRequest.

## Changed Behavior

### Default Profile

The default profile is now off the record. To have a standard profile with disk-cache and cookies, we recommend creating your own profile and using that explicitly.

### QRC Scheme

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.

Porting from Qt WebKit to Qt WebEngine ◦ Qt WebEngine Licensing