Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. WebView crash when is in Loader
Forum Updated to NodeBB v4.3 + New Features

WebView crash when is in Loader

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CharlieGC Offline
    CharlieGC Offline
    CharlieG
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! On which platform do you observe this behavior?

      CharlieGC 1 Reply Last reply
      0
      • ? A Former User

        Hi! On which platform do you observe this behavior?

        CharlieGC Offline
        CharlieGC Offline
        CharlieG
        wrote on last edited by
        #3

        @Wieland
        Hi,

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

        1 Reply Last reply
        0
        • AlexorleonA Offline
          AlexorleonA Offline
          Alexorleon
          wrote on last edited by
          #4

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

          CharlieGC 1 Reply Last reply
          0
          • AlexorleonA Alexorleon

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

            CharlieGC Offline
            CharlieGC Offline
            CharlieG
            wrote on last edited by
            #5

            @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...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved