PDA

View Full Version : creating a hyperlink



filmfreak
16th February 2006, 21:40
I'm working with a dialog box in Qt 3.2.1 and I'm trying to create a hyperlink using either a text edit or a text label. I tried the following with both:

<a href="mailto:mail@host.com">click here</a>

With the text edit, the tags were displayed along with the text. With the text label, the words "click here" were displayed and were blue and underlined, but the link didn't exist (nothing happened when I clicked on or moved my mouse pointer over the words).

What am I missing?

Bojan
22nd February 2006, 01:49
This is the expected behaviour. QLabel doesn't handle clicking of links. In fact Qt is unable to just "open a browser" and go to the link.

You can try this:

http://osdab.sourceforge.net/devcorner/urllabel.php

This is a QLabel, based on KURLLabel, that has a signal for when it is clicked. Note however, that you still have to handle openning of the browser yourself in the connected slot.

Here's some info regarding that:

http://www.qtcentre.org/forum/showthread.php?t=233

Bojan