4

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. enter image description here

zonzely
  • 395
  • 3
  • 6
  • 17
  • 1
    Possible duplicate of [How to install a missing Qt module?](http://stackoverflow.com/questions/40200094/how-to-install-a-missing-qt-module) – Mike Feb 25 '17 at 00:13
  • What's your target platform? – MrEricSir Feb 25 '17 at 00:53
  • @MrEricSir: "My os is win10 and the version of QT is Qt5.7 mingw53_32."[quote: first line of the post]. As cross-compile is not mentioned, I think it is safe to assume that this is the target platform? – derM - not here for BOT dreams Feb 25 '17 at 01:26
  • 1
    @derM That's not really an answer to the question -- the reason I'm asking is because WebView is available for WinRT, but not Win32. Qt could do a better job of calling that out in their documentation. – MrEricSir Feb 25 '17 at 01:31
  • I did not know there are multiple target platforms for win10. Interesting. Confusing. Thanks. ;-) – derM - not here for BOT dreams Feb 25 '17 at 01:40
  • @Mike I had install many modules, maybe I miss something. – zonzely Feb 25 '17 at 04:54
  • @MrEricSir there are different types of web views, the one used here is the wrapper around a native browser engine for platforms that don't allow any other. On platforms without such restrictions, e.g. Win32, an application can use a fully integrated engine, e.g. http://doc.qt.io/qt-5/qml-qtwebengine-webengineview.html – Kevin Krammer Feb 25 '17 at 09:39

2 Answers2

6

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

Kevin Krammer
  • 5,159
  • 2
  • 9
  • 22
3

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

TenG
  • 3,843
  • 2
  • 25
  • 42