QT:未安装模块“QtWebView”

时间:2017-02-25 00:06:19

标签: qt qml qt5.7 qtwebview

我的操作系统是win10,QT的版本是Qt5.7 mingw53_32,目标操作系统是win10。当我使用qmlscene来执行qml文件时,发生了一些错误:

  

qrc:/ [...]。qml:3模块“QtWebView”未安装

我的qml文件正在关注。

import QtQuick 2.0
import QtQuick.Controls 1.0
import QtWebView 1.1

ScrollView {
    width: 1280
    height: 720
    WebView {
        id: webview
        url: "http://www.baidu.com"
        anchors.fill: parent
        onNavigationRequested: {
            // detect URL scheme prefix, most likely an external link
            var schemaRE = /^\w+:/;
            if (schemaRE.test(request.url)) {
                request.action = WebView.AcceptRequest;
            } else {
                request.action = WebView.IgnoreRequest;
                // delegate request.url here
            }
        }
    }
}

我安装了一些模块。 enter image description here

2 个答案:

答案 0 :(得分:4)

QtWebView是一个模块,它针对iOS等限制性平台提供围绕特定于平台的Web视图的包装器组件,这些平台不允许应用程序提供自己的HTML内容呈现器。

在桌面Windows等功能完备的平台上,您可以使用功能更强大的Web渲染器集成,例如:由QtWebEngine moduleQtWebKit module提供的

答案 1 :(得分:0)

启动使用QtWebView的应用程序时,我在使用Qt 5.12的Ubuntu 18.04上收到了相同的警告。

我的解决方法是运行:

sudo apt-get install libqt5webview5

sudo apt-get install qml-module-qtwebview