PyQt4: Clickable links in QLabel?

Tina I tinaweb at bestemselv.com
Wed Mar 7 13:30:04 CET 2007


David Boddie wrote:
> On Thursday 01 March 2007 09:00, Tina I wrote:
> 
>> A short and sweet question: Is it possible to put a clickable link in a
>> QLabel that will open in the systems default browser?
> 
> Yes.
> 
>> I tried to put in some HTML but it did (of course?) simply display the
>> code instead of a link. I also tried to set openExternalLinks 'true' but
>> then pyuic4 bombed.
> 
> Well, that shouldn't happen. :-(
> 
> Can you send a bug report to the PyQt mailing list (assuming you're
> subscribed to it) with the error message or backtrace that you get
> when this happens?
> 
>> I see that QLabel does not have a html text format but I'm still hoping
>> it's possible. I really need a link on my main window form.
> 
> If you enclose the HTML with <qt> and </qt> tags, the HTML should be
> displayed properly. Any other matching tags should also work, so you
> could use <p> and </p> if you want.
> 
> Setting the label's openExternalLinks property to True should then
> enable what you want. You can try this out by previewing the form in
> Qt Designer.
> 
> David
Thanks David,

This is embarrassing... but my PyQt4 was too old *blush*
I can't believe I didn't think of double checking what version I had 
installed. A swift upgrade and it works like a charm :)

Tina



More information about the Python-list mailing list