KURLLabel Class Reference
A label class that supports displaying an active hyperlink. A drop-in replacement for QLabel that displays hyperlinks. More...
#include <kurllabel.h>
Inheritance diagram for KURLLabel:

Public Slots | |
void | setUnderline (bool on=true) |
Turns on or off the underlining. | |
void | setURL (const QString &url) |
Sets the URL for this label to url . | |
virtual void | setFont (const QFont &) |
Overridden for internal reasons; the API remains unaffected. | |
void | setUseTips (bool on=true) |
Turns on or off the tool tip feature. | |
void | setTipText (const QString &tip) |
Specifies what text to display when tooltips are turned on. | |
void | setHighlightedColor (const QColor &highcolor) |
Sets the highlight color. | |
void | setHighlightedColor (const QString &highcolor) |
This is an overloaded version for convenience. | |
void | setSelectedColor (const QColor &selcolor) |
Sets the selected color. | |
void | setSelectedColor (const QString &selcolor) |
This is an overloaded version for convenience. | |
void | setUseCursor (bool on, QCursor *cursor=0L) |
Turns the custom cursor feature on or off. | |
void | setGlow (bool glow=true) |
Turns on or off the "glow" feature. | |
void | setFloat (bool do_float=true) |
Turns on or off the "float" feature. | |
void | setAltPixmap (const QPixmap &altPix) |
Sets the "alt" pixmap. | |
Signals | |
void | enteredURL (const QString &url) |
Emitted when the mouse has passed over the label. | |
void | enteredURL () |
Emitted when the mouse has passed over the label. | |
void | leftURL (const QString &url) |
Emitted when the mouse is no longer over the label. | |
void | leftURL () |
Emitted when the mouse is no longer over the label. | |
void | leftClickedURL (const QString &url) |
Emitted when the user clicked the left mouse button on this label. | |
void | leftClickedURL () |
Emitted when the user clicked the left mouse button on this label. | |
void | rightClickedURL (const QString &url) |
Emitted when the user clicked the right mouse button on this label. | |
void | rightClickedURL () |
Emitted when the user clicked the left mouse button on this label. | |
void | middleClickedURL (const QString &url) |
Emitted when the user clicked the middle mouse button on this label. | |
void | middleClickedURL () |
Emitted when the user clicked the left mouse button on this label. | |
Public Methods | |
KURLLabel (QWidget *parent=0L, const char *name=0L) | |
Default constructor. | |
KURLLabel (const QString &url, const QString &text=QString::null, QWidget *parent=0L, const char *name=0L) | |
Convenience constructor. | |
virtual | ~KURLLabel () |
Destructs the label. | |
const QString & | url () const |
Returns the URL. | |
const QString & | tipText () const |
Returns the current tooltip text. | |
bool | useTips () const |
bool | useCursor () const |
bool | isGlowEnabled () const |
When this is on, the text will switch to the selected color whenever the mouse passes over it. | |
bool | isFloatEnabled () const |
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. | |
const QPixmap * | altPixmap () const |
Protected Methods | |
virtual void | mouseReleaseEvent (QMouseEvent *) |
Overridden for internal reasons; the API remains unaffected. | |
virtual void | enterEvent (QEvent *) |
Overridden for internal reasons; the API remains unaffected. | |
virtual void | leaveEvent (QEvent *) |
Overridden for internal reasons; the API remains unaffected. |
Detailed Description
A label class that supports displaying an active hyperlink. A drop-in replacement for QLabel that displays 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 QString&)), SLOT(processMyURL(const QString&)));
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.
- Author:
- Kurt Granroth <granroth@kde.org> (Interface) , Peter Putzer <putzer@kde.org> (Rewrite)
- Version:
- Id:
- kurllabel.h,v 1.20 2002/03/04 00:51:52 lunakl Exp
Definition at line 63 of file kurllabel.h.
Constructor & Destructor Documentation
|
Default constructor. Use setURL() and setText() or QListView::setPixmap() to set the resp. properties. Definition at line 66 of file kurllabel.cpp. References KCursor::handCursor(), and setFont(). |
|
Convenience constructor.
parent and name are passed to QLabel.
Definition at line 56 of file kurllabel.cpp. References KCursor::handCursor(), and setFont(). |
|
Destructs the label.
Definition at line 75 of file kurllabel.cpp. |
Member Function Documentation
|
Returns the URL.
Definition at line 151 of file kurllabel.cpp. |
|
Returns the current tooltip text.
Definition at line 197 of file kurllabel.cpp. |
|
Definition at line 192 of file kurllabel.cpp. |
|
Definition at line 170 of file kurllabel.cpp. |
|
When this is on, the text will switch to the selected color whenever the mouse passes over it.
Definition at line 238 of file kurllabel.cpp. |
|
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. Definition at line 243 of file kurllabel.cpp. |
|
Definition at line 253 of file kurllabel.cpp. |
|
Turns on or off the underlining.
When this is on, the text will be underlined. By default, it is Definition at line 117 of file kurllabel.cpp. References setFont(). Referenced by KDialogBase::enableLinkedHelp(), enterEvent(), and leaveEvent(). |
|
Sets the URL for this label to
Definition at line 141 of file kurllabel.cpp. References setUseTips(). Referenced by KBugReport::KBugReport(). |
|
Overridden for internal reasons; the API remains unaffected.
Reimplemented from QLabel. Definition at line 109 of file kurllabel.cpp. References QLabel::setFont(), and QFont::setUnderline(). Referenced by KURLLabel(), and setUnderline(). |
|
Turns 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 Definition at line 175 of file kurllabel.cpp. References QToolTip::add(), and QToolTip::remove(). Referenced by setTipText(), and setURL(). |
|
Specifies what text to display when tooltips are turned on. If this is not used, the tip will default to the URL.
Definition at line 185 of file kurllabel.cpp. References setUseTips(). |
|
Sets the highlight color.
This is the default foreground color (non-selected). By default, it is Definition at line 202 of file kurllabel.cpp. Referenced by setHighlightedColor(). |
|
This is an overloaded version for convenience.
Definition at line 210 of file kurllabel.cpp. References setHighlightedColor(). |
|
Sets 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 Definition at line 215 of file kurllabel.cpp. Referenced by setSelectedColor(). |
|
This is an overloaded version for convenience.
Definition at line 223 of file kurllabel.cpp. References setSelectedColor(). |
|
Turns the custom cursor feature on or off. 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.
Definition at line 156 of file kurllabel.cpp. References KCursor::handCursor(). |
|
Turns 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 Definition at line 228 of file kurllabel.cpp. |
|
Turns 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 Definition at line 233 of file kurllabel.cpp. Referenced by KDialogBase::enableLinkedHelp(). |
|
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' in javascript.
Definition at line 248 of file kurllabel.cpp. |
|
Emitted when the mouse has passed over the label.
|
|
Emitted when the mouse has passed over the label.
Referenced by enterEvent(). |
|
Emitted when the mouse is no longer over the label.
|
|
Emitted when the mouse is no longer over the label.
Referenced by leaveEvent(). |
|
Emitted when the user clicked the left mouse button on this label.
|
|
Emitted when the user clicked the left mouse button on this label.
Referenced by mouseReleaseEvent(). |
|
Emitted when the user clicked the right mouse button on this label.
|
|
Emitted when the user clicked the left mouse button on this label.
Referenced by mouseReleaseEvent(). |
|
Emitted when the user clicked the middle mouse button on this label.
|
|
Emitted when the user clicked the left mouse button on this label.
Referenced by mouseReleaseEvent(). |
|
Overridden for internal reasons; the API remains unaffected.
Definition at line 80 of file kurllabel.cpp. References QMouseEvent::button(), leftClickedURL(), middleClickedURL(), and rightClickedURL(). |
|
Overridden for internal reasons; the API remains unaffected.
Definition at line 258 of file kurllabel.cpp. References enteredURL(), QLabel::pixmap(), QLabel::setPixmap(), and setUnderline(). |
|
Overridden for internal reasons; the API remains unaffected.
Definition at line 284 of file kurllabel.cpp. References leftURL(), QLabel::pixmap(), QLabel::setPixmap(), and setUnderline(). |
The documentation for this class was generated from the following files: