Do you want to know how your customers use your applications and devices? Try Qt Insight Beta.
最新版Qt 6.3已正式发布。 了解更多。
最新バージョンQt 6.3がご利用いただけます。 詳細はこちら

Qt WebEngine in Qt 6

Qt WebEngine has been out for Qt 6 since 6.2, but I would still like to talk a bit about what is different in WebEngine in Qt 6, and what will change in the Qt 6 time frame.

Releases

There had been talk about splitting WebEngine from the general Qt release. This hasn't happened yet, but we are working on providing a newer WebEngine (6.3) with Qt 6.2 once it hits LTS. That work will also ensure all users can easily use a newer WebEngine with an older Qt 6 version. As is, we do spot testing of newing WebEngine versions with last LTS branch (6.2), so it mostly work, but users could hit conflicts due to untested combinations of changes or settings.

Qt WebEngine 6.3 will be based on Chromium 94, we are currently working on a Chromium 98 rebase, but it is too late for 6.3, and instead go to Qt 6.4, though 6.4 will likely end up with something based on Chromium 100+ once that has been released and rebased upon.

Qt WebEngine 6.3 is also finally switching to building with python 3 as Chromium finally switched off depending on python 2 late last year.

RHI Support

Qt 6 moved off the OpenGL default rendering to the multi-backend RHI rendering framework. Qt WebEngine is however relying on Chromium which is still using OpenGL internally, and QQuickWidget which still only supports the OpenGL and software backends. This means for now WebEngine only works with OpenGL or software, and will try to set the default rendering backend to OpenGL when loaded, and if failing that, use software rendering. A patchset exists to enable Vulkan rendering, but the uneven quality of Vulkan drivers has made it hard to test, and since it isn't default anywhere of lower priority, users interested are welcome to test the change, it is QML-only since the widgets code uses QQuickWidget as previously mentioned. We are looking into solutions to be able to use hardware accelerated rendering also with Metal and D3D11 backend, and fix the dependency on QQuickWidget.

API Changes

WebEngine had many duplicated APIs in Qt 5 in both Widgets and QML. In Qt 6 many of those APIs have been unified into classes in Qt WebEngineCore. In most case this makes very little difference to users, unless you had the module name in the C++ include lines. Most of the new core API has been moved from WebEngineWidgets into WebEngineCore, but a few has been moved from WebEngineQuick to WebEngineCore, and provides new API for C++ users.

The QML module is now called WebEngineQuick instead of WebEngine, to disambiguate it from the super module.

Some methods have been introduced to avoid users having to derive from QWebEnginePage. For instance work done QWebEnginePage::createWindow() can now also be done by handling the QWebEnginePage::newWindowRequested() signal. Similarly  QWebEnginePage::acceptNavigationRequest() can be implemented by handling the QWebEnginePage::navigationRequested() signal. These new request objects also provide more data than the old method call did.

QWebEngineDownloadItem has been renamed QWebEngineDownloadRequest to be more consistent with other API.

QWebEngineLoadingInfo used to be WebEngineLoadRequest in QML, and is new API in C++. It provides more information about loading progress and errors.

QWebEngineProfile, QWebEngineScript, QWebEngineScriptCollection, QWebEngineClientCertificationSelection, QWebEngineSettings and QWebEngineFullscreenRequest have all been moved from WebEngineWidgets to WebEngineCore with minimal changes.

Future API

One of the APIs we hope to introduce is a QtGUI only replacement for QWebEngineView called QWebEngineWindow. This should also help us avoid the dependency on QQuickWidget and its limitations. It is targeted for Qt 6.4 or 6.5.

Other work include using ANGLE inside Chromium to be able to render onto D3D or Metal. This is also what the Vulkan implementation  does internally, but Chromium only has OpenGL, Software and Vulkan compositor APIs for embedders at this point.

 


Blog Topics:

Comments