简体   繁体   English

如何在QtWebView中使链接可点击?

[英]how do i make links clickable in QtWebView?

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. 我正在使用QtWebView编写Web浏览器,我使用html页面对其进行了测试,但事实证明链接无法正常工作。 What do i do? 我该怎么办?

You should set a "link delegation policy" for WebView's page, because it defaults to "DontDelegateLinks". 您应该为WebView的页面设置“链接委派策略”,因为它默认为“DontDelegateLinks”。

Try: 尝试:

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

And connect page's link_clicked() signal to appropriate slot. 并将页面的link_clicked()信号连接到适当的插槽。

Look at: 看着:

http://doc.qt.nokia.com/4.7-snapshot/qwebview.html#page 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-prop

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python、Flask - 如何在模板文件夹中创建可点击的链接并重定向到不同的页面? - Python, Flask - How do I make clickable links in the templates folder and redirect to a different page? 如何在QWizard的副标题中点击链接? - How to make links in a QWizard's subtitle clickable? 如何使熊猫数据框中的链接可点击? - How to make links in pandas dataframe clickable? 如何在 Django 的渲染模板中使链接可点击? - How do I make the link clickable in the rendered template in Django? 如何在 jupyter notebook 中制作带有可点击单元格的表格? - How do I make a table with clickable cells in jupyter notebook? 如何制作一个可点击的图像,给我点击的坐标? - How do I make a clickable image that gives me the coordinates of the click? 如何使用 python 将纯文本中的 URL 转换为可点击的链接? - How do I convert URL in a plain text to clickable links using python? 如何使可点击的按钮运行子程序? Python 3.XX - How do I make a clickable button run a subprugram? Python 3.X.X 在我的Django TextField中点击链接 - Make links clickable in my Django TextField 如何等待对象不可点击? - How do I wait for an object to NOT be clickable?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM