WebView crash when is in Loader



  • Hi,

    Have you noticed that WebView crash when used in Loader ?

    Here a simply example :

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.0
    import QtWebView 1.1
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        Loader {
            id: loader
            anchors.fill: parent
            sourceComponent: view1
        }
    
        Component{
            id: view1
            WebView {
                anchors.fill: parent
                url: Qt.resolvedUrl("http://www.qt.io")
            }
        }
        Component{
            id: view2
            Rectangle {
                anchors.fill: parent
                color: "green"
            }
        }
    
        footer: TabBar {
            id: tabBar
            TabButton {
                text: qsTr("View1")
                onClicked: loader.sourceComponent = view1
            }
            TabButton {
                text: qsTr("View2")
                onClicked:  loader.sourceComponent = view2
            }
        }
    }
    

    Bye & good WE.

    Charlie


  • Moderators

    Hi! On which platform do you observe this behavior?



  • @Wieland
    Hi,

    I have this problem on Mac OSX 10.12 and Android 6.0.



  • QtWebView::initialize();
    Do you have this in main.cpp?



  • @Alexorleon
    Yes.

    Temporarily, I use WebView in a Item and load this item on my Loader :

    //MyWebView.qml
    Item {
        ....
        WebView {
            ...
        }
    }
    
    Loader {
        source: "MyWebView.qml"
    }
    

    and this works...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.