PDA

View Full Version : Redundant call of QWebPage::extension() after unsupportedContent(QNetworkReply*)



TropicalPenguin
26th February 2011, 15:31
In my QWebPage subclass, I have overridden both supportsExtension() and extension() to support the ErrorPageExtension extension type.

These two functions are called in most cases where data fails to load, and in most cases that's the appropriate behaviour.

However, I have also setForwardUnsupportedContent(true) on the subclass, and so the data that QWebPage doesn't know how to handle it forwards to the slot connected to unsupportedContent(QNetworkReply*).

What I don't understand is why it also (afterwards) calls extension with an ErrorPageExtension request, with a domain of QWebPage::WebKit.

If I handle the reply in my slot, is there any way to prevent it from making an ErrorPageExtension request?

Of course, I could just use extension() and get rid of the slot, since it handles _all_ the error cases. It's just - that will miss out on the QNetworkReply* passed to the slot, which could point to fairly important data.

Is this the appropriate behaviour? And if I wanted to override it, would a sensible way then be to return false from supportsExtension (for an ErrorPageExtension type) temporarily, just after handling the unsupportedContent() signal?

Or would it be better to just return false from extension() in this case? (since in most situations I will not want it to display an error page after handling the unsupported content successfully)

Thanks in advance.

TropicalPenguin
4th March 2011, 14:48
Last-ditch bump in the hope of finding someone in-the-know :)