Qt WebEngine 错误:gpu_process_transport_factory.cc(642)] 切换到软件合成
Error with Qt WebEngine : gpu_process_transport_factory.cc(642)] Switching to software compositing
背景
- 平台:windows10
- Qt 版本:5.12.1
我必须使用 QML QtWebKit 移植最初使用 Qt 4.7.4 完成的 QML 应用程序。这个 QML 非常简单,它只是显示一个本地 html。我阅读了 this web page 如何迁移 QtWebKit。
所以,在尝试了几个小时的错误之后,我决定这样做 qt example。
当我尝试执行该应用程序时,我得到以下输出:
[23912:5200:1125/182313.354:ERROR:gpu_process_transport_factory.cc(642)] Switching to software compositing.
[23912:5200:1125/182313.355:WARNING:gpu_process_transport_factory.cc(1007)] Lost UI shared context.
[23912:5836:1125/182313.911:WARNING:gpu_process_host.cc(583)] !GpuDataManagerImpl::GpuProcessStartAllowed()
[23912:5836:1125/182329.059:WARNING:gpu_process_host.cc(583)] !GpuDataManagerImpl::GpuProcessStartAllowed()
- 知道我做错了什么吗?
- 是否可以坚持使用 QtWebKit?
- QtWebEngine 是否是呈现简单 html 用户指南的最佳解决方案?
我的QtWebEngine代码:
#include <QtGui/QGuiApplication>
#include <QTQml/QQmlApplicationEngine>
#include <QTWebEngine/qtwebengineglobal.h>
int main(int argc, char *argv[])
{
QCoreApplication::setOrganizationName("QtExamples");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QtWebEngine::initialize();
engine.load(QUrl(QStringLiteral("qrc:/test/Resources/main.qml")));
return app.exec();
}
Qt WebEngine QML
import QtQuick 2.0
import QtQuick.Window 2.0
import QtWebEngine 1.0
Window {
width: 1024
height: 750
visible: true
WebEngineView {
anchors.fill: parent
url: "https://www.qt.io"
}
}
QtWebKit 代码
rootContext()->setContextProperty("uiDataLayer", pUiDataLayer);
setSource(QUrl("qrc:/SCmainWindow/Resources/userGuide.qml"));
QDeclarativeItem* item = qobject_cast<QDeclarativeItem*>(rootObject());
QtWebKit Qml
import QtQuick 1.1
import QtWebEngine 1.0
Rectangle {
id: userGuide
width: uiDataLayer.getUserGuideWindowWidth();
height: uiDataLayer.getUserGuideWindowHeight();
Flickable {
id: flickableWebView
anchors.fill: userGuide;
contentWidth: webView.width
contentHeight: webView.height
interactive: true
clip: true
WebEngineView {
id: webView
url : "file:///C:/SVN/products/faa_mx/vs2017.install2/install/MSVC10.0.x86.debug/lexix_verbyx/bin/win32/Lexis-UG-1.0-00.html";
}
}
}
知道我做错了什么吗?
这些不是 Qt 的错误,而是 Chromium 的错误,在许多情况下你必须忽略它们,在你的特定情况下表明应用程序试图使用 GPU 但出于兼容性问题它将使用 CPU(如果您从 CMD 中 运行 google chrome 并启用标志以进行调试,您应该会得到相同的错误。
因此请避免这些错误,因为您提供的代码是正确的。
是否可以坚持使用 QtWebKit?
您可以继续使用Qt WebKit,但Qt 没有官方支持,您必须手动编译。该项目托管于 https://github.com/qtwebkit/qtwebkit.
QtWebEngine 是否是呈现简单 html 用户指南的最佳解决方案?
"best" 是相对的,除非您指明 objective 允许您在每种技术/备选方案中衡量自己的参数。我可以向你指出的是,它是渲染网页的官方选项,html等使用HTML、js等
背景
- 平台:windows10
- Qt 版本:5.12.1
我必须使用 QML QtWebKit 移植最初使用 Qt 4.7.4 完成的 QML 应用程序。这个 QML 非常简单,它只是显示一个本地 html。我阅读了 this web page 如何迁移 QtWebKit。
所以,在尝试了几个小时的错误之后,我决定这样做 qt example。
当我尝试执行该应用程序时,我得到以下输出:
[23912:5200:1125/182313.354:ERROR:gpu_process_transport_factory.cc(642)] Switching to software compositing.
[23912:5200:1125/182313.355:WARNING:gpu_process_transport_factory.cc(1007)] Lost UI shared context.
[23912:5836:1125/182313.911:WARNING:gpu_process_host.cc(583)] !GpuDataManagerImpl::GpuProcessStartAllowed()
[23912:5836:1125/182329.059:WARNING:gpu_process_host.cc(583)] !GpuDataManagerImpl::GpuProcessStartAllowed()
- 知道我做错了什么吗?
- 是否可以坚持使用 QtWebKit?
- QtWebEngine 是否是呈现简单 html 用户指南的最佳解决方案?
我的QtWebEngine代码:
#include <QtGui/QGuiApplication>
#include <QTQml/QQmlApplicationEngine>
#include <QTWebEngine/qtwebengineglobal.h>
int main(int argc, char *argv[])
{
QCoreApplication::setOrganizationName("QtExamples");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
QtWebEngine::initialize();
engine.load(QUrl(QStringLiteral("qrc:/test/Resources/main.qml")));
return app.exec();
}
Qt WebEngine QML
import QtQuick 2.0
import QtQuick.Window 2.0
import QtWebEngine 1.0
Window {
width: 1024
height: 750
visible: true
WebEngineView {
anchors.fill: parent
url: "https://www.qt.io"
}
}
QtWebKit 代码
rootContext()->setContextProperty("uiDataLayer", pUiDataLayer);
setSource(QUrl("qrc:/SCmainWindow/Resources/userGuide.qml"));
QDeclarativeItem* item = qobject_cast<QDeclarativeItem*>(rootObject());
QtWebKit Qml
import QtQuick 1.1
import QtWebEngine 1.0
Rectangle {
id: userGuide
width: uiDataLayer.getUserGuideWindowWidth();
height: uiDataLayer.getUserGuideWindowHeight();
Flickable {
id: flickableWebView
anchors.fill: userGuide;
contentWidth: webView.width
contentHeight: webView.height
interactive: true
clip: true
WebEngineView {
id: webView
url : "file:///C:/SVN/products/faa_mx/vs2017.install2/install/MSVC10.0.x86.debug/lexix_verbyx/bin/win32/Lexis-UG-1.0-00.html";
}
}
}
知道我做错了什么吗?
这些不是 Qt 的错误,而是 Chromium 的错误,在许多情况下你必须忽略它们,在你的特定情况下表明应用程序试图使用 GPU 但出于兼容性问题它将使用 CPU(如果您从 CMD 中 运行 google chrome 并启用标志以进行调试,您应该会得到相同的错误。
因此请避免这些错误,因为您提供的代码是正确的。
是否可以坚持使用 QtWebKit?
您可以继续使用Qt WebKit,但Qt 没有官方支持,您必须手动编译。该项目托管于 https://github.com/qtwebkit/qtwebkit.
QtWebEngine 是否是呈现简单 html 用户指南的最佳解决方案?
"best" 是相对的,除非您指明 objective 允许您在每种技术/备选方案中衡量自己的参数。我可以向你指出的是,它是渲染网页的官方选项,html等使用HTML、js等