Qt WebEngine错误:gpu_process_transport_factory.cc(642)]切换到软件合成

问题描述 投票:2回答:1

背景

  • 平台:Windows 10
  • Qt版本:5.12.1

我必须使用QML QtWebKit移植最初由Qt 4.7.4完成的QML应用程序。这个QML非常简单,它只是显示一个本地html。我阅读了有关如何迁移QtWebKit的this web page

因此,经过几个小时的尝试,我决定执行此操作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()
  1. 知道我在做什么错吗?
  2. 是否可以坚持使用QtWebKit?
  3. 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 qml qtwebengine
1个回答
3
投票

知道我在做什么错吗?

不是Qt的错误,而是铬的错误,在许多情况下,您必须忽略它们,在特定情况下,这些错误表明应用程序尝试使用GPU,但由于兼容性问题,它将使用CPU(您应该获得相同的如果您从CMD运行google chrome并启用这些标志以进行调试,则会出现错误)。

由于提供的代码正确,因此请避免这些错误。

是否可以坚持使用QtWebKit?

您可以继续使用Qt WebKit,但是Qt没有官方支持,您必须手动进行编译。该项目托管在https://github.com/qtwebkit/qtwebkit中。

QtWebEngine是仅用于呈现简单的html用户指南的最佳解决方案吗?

“最佳”是相对的,除非您指出客观的参数,以使您可以在每种技术/替代方法中进行自我评估。我要指出的是,这是渲染使用HTML,js等的网页,html等的官方选项。

© www.soinside.com 2019 - 2024. All rights reserved.