You are not logged in.

#1 2014-06-03 20:24:45

libretecario
Member
Registered: 2014-06-03
Posts: 1

(Qt 5) WebView Using Qt Quick 1 code model instead of Qt Quick 2

Hi, I'm having a bug with WebView when developing a Qt Quick application. I cannot use the WebView, it either crashes the application or appears as a white Rectangle. The Qt version I'm using is 5.3.0.
The Qt Version uses /usr/bin/qmake-qt5

Qt Creator (version 3.1.1) sees an Issue with WebView .
This is the code to reproduce the issue, you start a Qt Quick 2 application and put the following in main.qml

import QtQuick 2.2
import QtQuick.Controls 1.1
import QtWebKit 3.0

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Rectangle {
        anchors.fill: parent
        WebView {
            id: webView
            url: "http://qt-project.org"
        }
    }
}

This is the issue message.

Using Qt Quick 1 code model instead of Qt Quick 2 (M324)

I searched in the Qt forums and found this issue which is identical to mine.
https://bugreports.qt-project.org/brows … RBUG-11666

I tried to follow the suggestions made there, checked the configuration of the project and deleted the qt4 from the Kits, so I'm not using it.

I also checked the file /usr/lib/qt/imports/QtWebKit/plugins.qmltypes which was empty, ran qmlplugindump-qt5 and put this in that file:

import QtQuick.tooling 1.1

// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
// 'qmlplugindump-qt5 QtWebKit 3.0'

Module {
    Component {
        name: "QIODevice"
        prototype: "QObject"
        Signal { name: "readyRead" }
        Signal {
            name: "bytesWritten"
            Parameter { name: "bytes"; type: "qlonglong" }
        }
        Signal { name: "aboutToClose" }
        Signal { name: "readChannelFinished" }
    }
    Component {
        name: "QNetworkReply"
        prototype: "QIODevice"
        exports: ["NetworkReply 3.0"]
        isCreatable: false
        exportMetaObjectRevisions: [0]
        Enum {
            name: "NetworkError"
            values: {
                "NoError": 0,
                "ConnectionRefusedError": 1,
                "RemoteHostClosedError": 2,
                "HostNotFoundError": 3,
                "TimeoutError": 4,
                "OperationCanceledError": 5,
                "SslHandshakeFailedError": 6,
                "TemporaryNetworkFailureError": 7,
                "NetworkSessionFailedError": 8,
                "BackgroundRequestNotAllowedError": 9,
                "UnknownNetworkError": 99,
                "ProxyConnectionRefusedError": 101,
                "ProxyConnectionClosedError": 102,
                "ProxyNotFoundError": 103,
                "ProxyTimeoutError": 104,
                "ProxyAuthenticationRequiredError": 105,
                "UnknownProxyError": 199,
                "ContentAccessDenied": 201,
                "ContentOperationNotPermittedError": 202,
                "ContentNotFoundError": 203,
                "AuthenticationRequiredError": 204,
                "ContentReSendError": 205,
                "ContentConflictError": 206,
                "ContentGoneError": 207,
                "UnknownContentError": 299,
                "ProtocolUnknownError": 301,
                "ProtocolInvalidOperationError": 302,
                "ProtocolFailure": 399,
                "InternalServerError": 401,
                "OperationNotImplementedError": 402,
                "ServiceUnavailableError": 403,
                "UnknownServerError": 499
            }
        }
        Signal { name: "metaDataChanged" }
        Signal { name: "finished" }
        Signal {
            name: "error"
            Parameter { type: "QNetworkReply::NetworkError" }
        }
        Signal { name: "encrypted" }
        Signal {
            name: "sslErrors"
            Parameter { name: "errors"; type: "QList<QSslError>" }
        }
        Signal {
            name: "uploadProgress"
            Parameter { name: "bytesSent"; type: "qlonglong" }
            Parameter { name: "bytesTotal"; type: "qlonglong" }
        }
        Signal {
            name: "downloadProgress"
            Parameter { name: "bytesReceived"; type: "qlonglong" }
            Parameter { name: "bytesTotal"; type: "qlonglong" }
        }
        Method { name: "abort" }
        Method { name: "ignoreSslErrors" }
    }
    Component {
        name: "QQuickWebPage"
        defaultProperty: "data"
        prototype: "QQuickItem"
        exports: ["WebPage 3.0"]
        isCreatable: false
        exportMetaObjectRevisions: [0]
    }
    Component {
        name: "QQuickWebView"
        defaultProperty: "flickableData"
        prototype: "QQuickFlickable"
        exports: ["WebView 3.0"]
        exportMetaObjectRevisions: [0]
        attachedType: "QQuickWebViewAttached"
        Enum {
            name: "NavigationRequestAction"
            values: {
                "AcceptRequest": 0,
                "IgnoreRequest": 255
            }
        }
        Enum {
            name: "LoadStatus"
            values: {
                "LoadStartedStatus": 0,
                "LoadStoppedStatus": 1,
                "LoadSucceededStatus": 2,
                "LoadFailedStatus": 3
            }
        }
        Enum {
            name: "ErrorDomain"
            values: {
                "NoErrorDomain": 0,
                "InternalErrorDomain": 1,
                "NetworkErrorDomain": 2,
                "HttpErrorDomain": 3,
                "DownloadErrorDomain": 4
            }
        }
        Enum {
            name: "NavigationType"
            values: {
                "LinkClickedNavigation": 0,
                "FormSubmittedNavigation": 1,
                "BackForwardNavigation": 2,
                "ReloadNavigation": 3,
                "FormResubmittedNavigation": 4,
                "OtherNavigation": 5
            }
        }
        Property { name: "title"; type: "string"; isReadonly: true }
        Property { name: "url"; type: "QUrl" }
        Property { name: "icon"; type: "QUrl"; isReadonly: true }
        Property { name: "canGoBack"; type: "bool"; isReadonly: true }
        Property { name: "canGoForward"; type: "bool"; isReadonly: true }
        Property { name: "loading"; type: "bool"; isReadonly: true }
        Property { name: "loadProgress"; type: "int"; isReadonly: true }
        Signal { name: "navigationHistoryChanged" }
        Signal {
            name: "loadingChanged"
            Parameter { name: "loadRequest"; type: "QWebLoadRequest"; isPointer: true }
        }
        Signal {
            name: "linkHovered"
            Parameter { name: "hoveredUrl"; type: "QUrl" }
            Parameter { name: "hoveredTitle"; type: "string" }
        }
        Signal {
            name: "navigationRequested"
            Parameter { name: "request"; type: "QWebNavigationRequest"; isPointer: true }
        }
        Method {
            name: "loadHtml"
            Parameter { name: "html"; type: "string" }
            Parameter { name: "baseUrl"; type: "QUrl" }
            Parameter { name: "unreachableUrl"; type: "QUrl" }
        }
        Method {
            name: "loadHtml"
            Parameter { name: "html"; type: "string" }
            Parameter { name: "baseUrl"; type: "QUrl" }
        }
        Method {
            name: "loadHtml"
            Parameter { name: "html"; type: "string" }
        }
        Method { name: "goBack" }
        Method { name: "goForward" }
        Method { name: "stop" }
        Method { name: "reload" }
    }
    Component {
        name: "QQuickWebViewAttached"
        prototype: "QObject"
        Property { name: "view"; type: "QQuickWebView"; isReadonly: true; isPointer: true }
    }
    Component {
        name: "QWebLoadRequest"
        prototype: "QObject"
        exports: ["WebLoadRequest 3.0"]
        isCreatable: false
        exportMetaObjectRevisions: [0]
        Property { name: "url"; type: "QUrl"; isReadonly: true }
        Property { name: "status"; type: "QQuickWebView::LoadStatus"; isReadonly: true }
        Property { name: "errorString"; type: "string"; isReadonly: true }
        Property { name: "errorDomain"; type: "QQuickWebView::ErrorDomain"; isReadonly: true }
        Property { name: "errorCode"; type: "int"; isReadonly: true }
    }
    Component {
        name: "QWebNavigationRequest"
        prototype: "QObject"
        exports: ["NavigationRequest 3.0"]
        isCreatable: false
        exportMetaObjectRevisions: [0]
        Property { name: "url"; type: "QUrl"; isReadonly: true }
        Property { name: "mouseButton"; type: "int"; isReadonly: true }
        Property { name: "keyboardModifiers"; type: "int"; isReadonly: true }
        Property { name: "action"; type: "QQuickWebView::NavigationRequestAction" }
        Property { name: "navigationType"; type: "QQuickWebView::NavigationType"; isReadonly: true }
    }
}

The result is the same with or without it, the issue doesn't go away and you can't use the WebView. I've run out of ideas, I don't know what to do. Does anybody know why this happens?

Thanks a lot.

Last edited by libretecario (2014-06-03 20:31:03)

Offline

#2 2014-08-18 21:28:58

vri
Member
Registered: 2008-08-17
Posts: 35

Re: (Qt 5) WebView Using Qt Quick 1 code model instead of Qt Quick 2

Some time has passed, yet I have the same problem. Have you been able to solve it?

Offline

#3 2014-08-19 10:55:49

vri
Member
Registered: 2008-08-17
Posts: 35

Re: (Qt 5) WebView Using Qt Quick 1 code model instead of Qt Quick 2

Don't know whether you used CMake or not, but I did and that caused the problem, see https://bugreports.qt-project.org/brows … RBUG-11328

Workaround for me is to have a qmake based project open in the same session, then the proper QML_IMPORT_PATH is set.

Offline

Board footer

Powered by FluxBB