How can i show loading icon/gif while the page is loading in webview ?



  • Hello , i want to show a animated gif or just a simple text to show that page is being loaded .

    for ex : i am opening some site till the site is fully loaded show some loading bar or gif that the page is loading

    qml code that i am using :

    WebView {
            id: webView
            anchors.fill: parent
            url: "http://somesite.com"
    
        }
    


  • @Qjay You can use loading property and loadingChanged() signal of Webview to play with your loading animation. Further, you can use loadProgress property to show the progress as well.



  • @Yashpal Hey man , can you provide 1 simple example for it !!

    thanks !!



  • You can do something like this.

    WebView {
            id: webView
            anchors.fill: parent
            url: "http://somesite.com"
    }
    
    BusyIndicator{
            anchors.centerIn: parent
            running: webView.loading === true
    }
    

    or

    WebView {
            id: webView
            anchors.fill: parent
            url: "http://somesite.com"
            onLoadingChanged: {
                    if(loading === true) //start animation
                    else
                    if(loading === false) //stop animation
                    else { /*do nothing*/ }
          }
    }
    

Log in to reply
 

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