I'm trying to preload a few webpages in a series of hidden QWebFrames
before I show them. However, I've found that the setContent
method for a QWebFrame
causes the GUI to become unresponsive.
I've tried putting the actual network activity in a separate thread and giving it to the QWebFrame
as a QByteArray
, but that doesn't help, leading me to believe that it is the painting of the page that is causing the ~1.5 second, very noticeable slowdown.
QByteArray data = pReply->readAll(); //get the content from a QNetworkReply
this->page->mainFrame()->setContent(data); //this is the line that causes the problem
I'm completely stumped and I don't know what to try, since I can't put the entire web frame in its own thread.
Has anyone run into this before and have any suggestions?
Update I profiled the application and confirmed that setContent is the root of the problem.
Update 2 I profiled the application using Intel VTune. I found that QWebKit is indeed taking up over 100% of the CPU time. The QWebSettings::handle usage jumped out at me as what appears to be using the most resources, and I can confirm that it is hogging up the main thread.
Unfortunately, I haven't found a workaround for this. I'm figuring out ways to mask the slowdown in the application itself as a way of coping. If anyone posts any better ideas, I'll accept their answer.