PDA

View Full Version : QWebPage error handling



Guilo
31st January 2010, 18:28
Hi !

I am usign QWebPage to parse an online page and to use its data in my application. It works great but I have a few questions for enhancements :

- How could I handle 404 error page. I can't find anything to analyse the request received from the server when using a QWebPage
- Is there a specific signal for timeout or do I just wait for loadFinished signal to be emitted with a QTime chrono ?

- I have tested my application on a network with a proxy. Here is the code of my proxy handling :


QNetworkAccessManager *manager = page->networkAccessManager();
QNetworkProxy *proxy = new QNetworkProxy();
proxy->setHostName("cache");
proxy->setPort(3128);
proxy->setType(QNetworkProxy::HttpProxy);
manager->setProxy(*proxy);

It works but fails randomly on loading some files, and if I use a QWebView it seems that loadfinished is never emitted. I don't know if it is specific to this proxy or if using a proxy requires a particular way of loading pages (such like a pause between each url load) but the same code without proxy manager works great on my computer, directly connected to the internet. So I wonder if it is possible to handle error and maybe response from the proxy.

Thanks a lot

Guilo
1st February 2010, 21:13
I have an other question. I use qwebpage but don't view them. But while my program continiously downloads pages, I notice 30~50% cpu usage and it makes the rest of my interface very slow. How could I solve this ?

Thanks

temppost2
21st September 2010, 05:48
I have the same problem with error handling in QWebPage.
For example, Arora browser uses QWebPage::unsupportedContent signal and appropriate slot to handle failed requests, but I cannot understand how it works: unsupportedContent throws only when QWebPage cannot handle request scheme (like file://, ftp://, etc) or if reply consists of special header Content-Disposition.