[PyKDE] Active links in a QLabel
Jim Bublitz
jbublitz at nwinternet.com
Tue Aug 17 18:06:33 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). KDE has a KURLLabel,
which I realize doesn't do you much good, but you could use the C++ code for
that as a reference (it does things like changing the cursor during
"mouse-over" too).
Jim
More information about the PyQt
mailing list