Search code examples
c++qtqwebview

QWebView elements load progress


I want to log every element that is loaded by request (images, javascripts, styles, etc). I load page via QWebView. But there is only basic signals like start loading, progress, finished loading. And can't find how can I record each step of what webview is doing. Or it's impossible?


Solution

  • The simplest thing you can do here is listen to QNetworkAccessManager's finished() signal.

    To get the AccessManager

    QNetworkAccessManager mgr = webView->page()->networkAccessManager();
    

    in the slot that catches the finished signal

    myclass::slot(QNetworkReply* reply)
    {
     ...
      reply->request()->url(); //gives you the resource requested.
      //DO NOT preform any other operation on 'request', request is sequential QIODevice.
    
     ...
     }