QT: module “QtWebView” is not installed

僤鯓⒐⒋嵵緔 提交于 2019-12-07 12:44:44

问题


My OS is win10 and the version of QT is Qt5.7 mingw53_32 and the target os is win10. when I use qmlscene to excute a qml file, it occurred some error:

qrc:/[...].qml:3 module "QtWebView" is not installed

My qml file is following.

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
            }
        }
    }
}

And I had installed some modules.


回答1:


QtWebView is a module which provides a wrapper component around a platform specific web view for restrictive platforms such as iOS which don't allow applications to provide their own HTML content renderers.

On a fully capable platform such as desktop Windows you can use a much more capable web renderer integration, e.g. the one provided by the QtWebEngine module or by the QtWebKit module




回答2:


I was getting the same warning reported on Ubuntu 18.04 with Qt 5.12 when launching an app that used QtWebView.

The fix in my case was to run:

sudo apt-get install libqt5webview5

sudo apt-get install qml-module-qtwebview



来源:https://stackoverflow.com/questions/42450333/qt-module-qtwebview-is-not-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!