开发者

how do i make links clickable in QtWebView?

开发者 https://www.devze.com 2023-03-25 19:01 出处:网络
I\'m in the process of writing a web browser with QtWebView, i tested it using an html page but it turns out the links are not working. W开发者_StackOverflow社区hat do i do?You should set a \"link del

I'm in the process of writing a web browser with QtWebView, i tested it using an html page but it turns out the links are not working. W开发者_StackOverflow社区hat do i do?


You should set a "link delegation policy" for WebView's page, because it defaults to "DontDelegateLinks".

Try:

webView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)

And connect page's link_clicked() signal to appropriate slot.

Look at:

http://doc.qt.nokia.com/4.7-snapshot/qwebview.html#page

http://doc.qt.nokia.com/4.7-snapshot/qwebpage.html#linkDelegationPolicy-prop

http://doc.qt.nokia.com/4.7-snapshot/qwebpage.html#LinkDelegationPolicy-enum

0

精彩评论

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