[PyKDE] Active links in a QLabel

Roberto Alsina ralsina at kde.org
Tue Aug 17 18:15:28 BST 2004

> On Tuesday 17 August 2004 09:12, Detlev Offenbach wrote:
>> I would like to display active links (like the one to the eric3
>> homepage)
>> in the about message box. I was able to get them show as links. However,
>> clicking on them didn't do anything.
> Neither QLabel (nor its base classes QFrame/QWidget) emit any signals, so
> you'd have to subclass it and overload one or more of the mouse*Event and
> keyPressEvent methods to capture the clicks/key presses, and then either
> directly or via a signal launch a browser and pass it the URL.
> Alternatively, you'd could derive something from QButton (abstract), which
> emits the necessary signals, but then you have to provide the paint code.
> I'm didn't find a "link" type widget in Qt (although that doesn't mean
> there
> isn't one - I'm kind of surprised there isn't any).

Absolute overkill: use a QTextBrowser or similar classes. Should be pretty
simple, even if it wastes a MB of RAM or two.

 ("\''/").__..-''"`-. .         Roberto Alsina
 `9_ 9  )   `-. (    ).`-._.`)  ralsina at kde.org
 (_Y_.)' ._   ) `._`.  " -.-'   KDE Developer (MFCH)
  _..`-'_..-_/ /-'_.'
(l)-'' ((i).' ((!.'             Buenos Aires - Argentina
Imminentizing the eschaton since 1971.

More information about the PyQt mailing list