Does QWebView/QWebPage download contents in a separate thread or in the main/gui thread?

StackOverflow https://stackoverflow.com/questions/3917263

  •  29-09-2019
  •  | 
  •  

문제

If it doesn't, then how can I explicitly force it to download asynchronously in a separated thread?

도움이 되었습니까?

해결책

According to the documentation for QWebView::setHtml():

Sets the content of the web view to the specified html.
External objects such as stylesheets or images referenced in the HTML document are located relative to baseUrl.
The html is loaded immediately; external objects are loaded asynchronously.

Same thing goes for QWebView::setContent(). Therefore, the raw HTML is loaded in the main thread, and any other references (images, stylesheets, etc.) are loaded asynchronously in a separate thread.

From experience, I can tell that QWebView::setUrl() also loads asynchronously, using a network manager to wait for the raw HTML, which will in turn load the other references, also asynchronously. As far as I know, there is no way to force QWebView to act sychcronously.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top