PyQt how to add link to QTextBrowser

2019-07-28 22:28发布

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条回答
在下西门庆
2楼-- · 2019-07-28 23:13

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>");

查看更多
登录 后发表回答