Jeff
Jeff

Reputation: 7210

PyQt how to add link to QTextBrowser

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.

Upvotes: 1

Views: 2115

Answers (1)

Michael Daum
Michael Daum

Reputation: 830

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

Upvotes: 4

Related Questions