[kdeui Index] [kdeui Hierarchy] [Headers]
A drop-in replacement for QLabel that displays hyperlinks. More...
#include <kurllabel.h>
Inherits: QLabel (qt)
A label class that supports displaying hyperlinks
KURLLabel is a drop-in replacement for QLabel that handles text in a fashion similar to how an HTML widget handles hyperlinks. The text can be underlined (or not) and set to different colors. It can also "glow" (cycle colors) when the mouse passes over it.
KURLLabel also provides signals for several events, including the mouse leaving and entering the text area and all forms of mouse clicking.
A typical usage would be something like so:
KURLLabel *address = new KURLLabel(this); address->setText("My homepage"); address->setURL("http://www.home.com/~me"); connect(address, SIGNAL(leftClickedURL(const char*)), SLOT(processMyURL(const char*)));
In this example, the text "My homepage" would be displayed as blue, underlined text. When the mouse passed over it, it would "glow" red. When the user clicks on the text, the signal leftClickedURL() would be emitted with "http://www.home.com/~me" as its argument.
[public]
Constructor. Use this exactly like you would QLabel.
[public virtual]
Destructor.
[public]
Returns the URL. This will be the same as text()
if
setURL is not used.
[public]
Returns the current text.
[public]
Returns the current pixmap.
[public]
Returns the recommended size for this label
[public]
Enables or disables "transparent mode". If transparent mode is enabled, the label copies its own background from its parent widget so that it seems to be transparent. Transparent mode is disabled by default. Please note that the method does not repaint the widget, changes take effect on the next repainting. Transparent widgets do (currently) not work if there is another widget (a frame, for example) layered between this widget and its parent in Z-order.
[public slot]
Turn on or off the "glow" feature. When this is on, the text will switch to the selected color whenever the mouse passes over it. By default, it is on.
[public slot]
Turn on or off the "float" feature. This feature is very similar to the "glow" feature in that the color of the label switches to the selected color when the cursor passes over it. In addition, underlining is turned on for as long as the mouse is overhead. Note that if "glow" and underlining are both already turned on, this feature will have no visible effect. By default, it is off.
[public slot]
Turn on or off the custom cursor feature. When this is on, the cursor will change to a custom cursor (default is a "pointing hand") whenever the cursor passes over the label. By default, it is on
[public slot]
Turn on or off the tool tip feature. When this is on, the URL will be displayed as a tooltip whenever the mouse passes passes over it. By default, it is off.
[public slot]
Specifies what text to display when tooltips are turned on. If this is not used, the tip will default to the URL.
[public slot]
Set the text alignment
[public slot]
Turn on or off the underlining. When this is on, the text will be underlined. By default, it is on
[public slot]
Set the highlight color. This is the default foreground color (non-selected). By default, it is blue.
[public slot]
This is an overloaded version for convenience.
[public slot]
Set the selected color. This is the color the text will change to when either a mouse passes over it and "glow" mode is on or when it is selected (clicked). By default, it is read
[public slot]
This is an overloaded version for convenience.
[public slot]
Set the background color. By default, it is set to the KDE background color.
[public slot]
This is an overloaded version for convenience.
[public slot]
Sets the font for the label.
[public slot]
Sets the label contents to text
[public slot]
Sets the pixmap. Unlike QLabel, this can co-exist with setText It cannot be used along with setMovie however.
[public slot]
Sets the "alt" pixmap. This pixmap will be displayed when the cursor passes over the label. The effect is similar to the trick done with 'onMouseOver' with javascript.
[public slot]
Sets the movie. Cannot be used with setPixmap
[public slot]
Sets the URL for this label to url
[protected]
Draws the text, pixmap, and/or movie
[protected]
Used to "glow" the text when it is selected.
[protected]
emit
s the enteredURL signal. If glow is
on, it sets the selected color.
[protected]
emit
s the leftURL signal. If glow is
on, it sets the normal color.
[protected]
Processes "true" leave events since mouseMoveEvent cannot
[protected]
Tracks if the cursor is above the text as well as the mouse state.
It emit
s either the enteredURL leftURL
leftClickedURL middleClickedURL or rightClickedURL as appropriate.
[protected]
emit
s either the leftClickedURL
rightClickedURL or middleClickedURL signal depending
on which one the user clicked. Changes the color to selected
to indicate that it was selected. Starts a timer to deselect
it.
[protected]
An overloaded repaint event that handles the background in transparent mode. It sets a background pixmap that is obtained from the widgets parent and calls the QLabel repaint handler after that.
[signal]
The mouse has passed over the label.
url | The URL for this label. |
[signal]
The mouse has passed over the label.
[signal]
The mouse is no longer over the label.
url | The URL for this label. |
[signal]
The mouse is no longer over the label.
[signal]
The user clicked the left mouse button on this label.
url | The URL for this label. |
[signal]
The user clicked the left mouse button on this label.
[signal]
The user clicked the right mouse button on this label.
url | The URL for this label. |
[signal]
The user clicked the left mouse button on this label.
[signal]
The user clicked the middle mouse button on this label.
url | The URL for this label. |
[signal]
The user clicked the left mouse button on this label.
| Kdoc |