I want to compile and run WebEngine Recipe Browser Example with Qt-6.2.3 or Qt_6_4_0 but I get this error:
QML debugging is enabled. Only use this in a safe environment.
qt.webenginecontext:
GLImplementation: desktop
Surface Type: OpenGL
Surface Profile: CompatibilityProfile
Surface Version: 4.6
Using Default SG Backend: yes
Using Software Dynamic GL: no
Using Angle: no
Init Parameters:
* application-name recipebrowser
* browser-subprocess-path /home/parisa/Applications/Qt/6.2.3/gcc_64/libexec/QtWebEngineProcess
* create-default-gl-context
* disable-features DnsOverHttpsUpgrade,ConsolidatedMovementXY,InstalledApp,BackgroundFetch,WebOTP,WebPayments,WebUSB,PictureInPicture
* disable-setuid-sandbox
* disable-speech-api
* enable-features NetworkServiceInProcess,TracingServiceInProcess
* enable-threaded-compositing
* gpu-preferences UAAAAAAAAAAoAAAQAAAAAAAAAAAAAAAAAABgAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAACAAAAAAAAAA=
* in-process-gpu
* use-gl desktop
and I see this result:
web pages (html content ) can't load from qrc (Resource file).
But as I Build and Run this example in Qt-5.15.2 it runs correctly.
The only difference between these two versions and examples is that Qt-5.15.2 uses QtWebEngine but in Qt-6.2.3 or Qt_6_4_0 they use QtWebEngineQuick.
I dont know how should I fix this issue and use QtWebEngineQuick.
I test QtWebEngineQuick and this issue will happen when I want to load any HTML file (even simple) from Resource , but if I choose url from web like https://stackoverflow.com it works correctly.
for example, if I want to Run this Example I got that Error!
in main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtWebEngineQuick/qtwebenginequickglobal.h>
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QtWebEngineQuick::initialize();
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}
in main.qml
import QtQuick
import QtQuick.Window
import QtWebEngine
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
WebEngineView {
id: webView
anchors.fill: parent
url: "qrc:/index.html"
}
}
in index.html
<html>
<head>
</head>
<body>
<h1>Hello World<h1>
</body>
</html>
error output picture:
I use Ubuntu 20.04 and NVIDIA 470 GPU. I don't understand why this happens and how can I fix it.



main.qmlandindex.htmlare at the same hierarchy. Then you should only need to specifyurl: "index.html"url: "index.html"too, but it didn't matter I have trouble even running Qt example ( WebEngine Recipe Browser) and the pages are not loaded"qrc:///index.html","index.html"and"qrc:/index.html"but in all of them, they can't load files. I have trouble even running the Qt example ( WebEngine Recipe Browser) and pages are not loading in that example, it uses"qrc:///pages/pizza.html"