开发者

Get http status in Qt WebKit

开发者 https://www.devze.com 2022-12-28 12:16 出处:网络
What I would like to implement is 1 Us开发者_StackOverflowing Qt\'s WebView(part of QtWebKit) to access some page.

What I would like to implement is

1 Us开发者_StackOverflowing Qt's WebView(part of QtWebKit) to access some page.

2 Show specified html page if got HTTP 4xx, 5xx status

(Ex> HTTP 404, 500).

3 Also shows specified page when network connection is unavailable.

For now, I had only done job 1... In job 2, how did I get http status from WebView ? In job 3, I'm looking about QUrl APIs now.

Anyone have idea or expreience yet ?


You should reimplement QWebPage::extension() with extension type of QWebPage::ErrorPageExtension.

For details see: http://doc.qt.io/qt-5/qwebpage.html#extension, http://doc.qt.io/qt-5/qwebpage-errorpageextensionoption.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号