I'm using a QWebPage without a QWebView because I want to render the contents of an HTML file onto a QPixmap/QImage.
I want the loading of the page to be done synchronously, not asynchronously which is the default. The default way is to call QWebFrame::setHtml()
or QWebFrame::setContent()
, but this loads images asynchronously. What I want is some sort of blocking function call, something like QWebFrame::waitUntilLoadFinished()
after which I could just call render()
and be done with it.
I can't find a way to do this. Am I missing something?
If someone still needs it, this is how I got it working.
mWebPage->mainFrame()->setHtml("...");
QEventLoop loop;
connect(mWebPage,SIGNAL(loadFinished(bool)),&loop,SLOT(quit()));
loop.exec();
/* your webpage has finished loading & is ready to use */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With