QWebView/QWebPage 是在单独的线程中还是在主/gui 线程中下载内容?
如果没有,那么我如何显式强制它在单独的线程中异步下载?
If it doesn't, then how can I explicitly force it to download asynchronously in a separated thread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 文档
QWebView::setHtml()
:QWebView::setContent()
也是如此。因此,原始 HTML 在主线程中加载,任何其他引用(图像、样式表等)在单独的线程中异步加载。根据经验,我可以看出 QWebView::setUrl() 也异步加载,使用网络管理器等待原始 HTML,这将依次加载其他引用,也是异步的。据我所知,没有办法强制QWebView同步动作。
According to the documentation for
QWebView::setHtml()
: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.