I don't know why I'm having such a hard time finding this, but how do you add a hyperlink to QTextEdit
or QTextBrowser
? I'm trying to make something that has a list of links and when you click on a link you get the object that the link is referencing.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You need to set the acceptRichText
property to true. Then you can just pass in HTML using the setHTML()
slot.
win.setHTML("<a href="http://foo>Bar</a>");