org.kde.koala

Class KURLLabel

public class KURLLabel extends QLabel

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(String)"),
                  SLOT("processMyURL(String)"));
 
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. \image html kurllabel.png "KDE URL Label" See KURLLabelSignals for signals emitted by KURLLabel

Version: $Id: KURLLabel.java 473384 2005-10-23 14:17:09Z rdale $

Author: Peter Putzer (Rewrite)

UNKNOWN: A drop-in replacement for QLabel that displays hyperlinks.

Constructor Summary
protected KURLLabel(Class dummy)
KURLLabel(QWidget parent, String name)
Default constructor.
KURLLabel(QWidget parent)
KURLLabel()
KURLLabel(String url, String text, QWidget parent, String name)
Convenience constructor.
KURLLabel(String url, String text, QWidget parent)
KURLLabel(String url, String text)
KURLLabel(String url)
Method Summary
QPixmapaltPixmap()
StringclassName()
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voidenterEvent(QEvent arg1)
Overridden for internal reasons; the API remains unaffected.
booleanevent(QEvent e)
Catch parent palette changes
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisFloatEnabled()
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.
booleanisGlowEnabled()
When this is on, the text will switch to the selected color whenever the mouse passes over it.
protected voidleaveEvent(QEvent arg1)
Overridden for internal reasons; the API remains unaffected.
QMetaObjectmetaObject()
protected voidmouseReleaseEvent(QMouseEvent arg1)
Overridden for internal reasons; the API remains unaffected.
voidsetAltPixmap(QPixmap altPix)
Sets the "alt" pixmap.
voidsetFloat(boolean do_float)
Turns on or off the "float" feature.
voidsetFloat()
voidsetFont(QFont arg1)
Overridden for internal reasons; the API remains unaffected.
voidsetGlow(boolean glow)
Turns on or off the "glow" feature.
voidsetGlow()
voidsetHighlightedColor(QColor highcolor)
Sets the highlight color.
voidsetHighlightedColor(String highcolor)
This is an overloaded version for convenience.
voidsetSelectedColor(QColor selcolor)
Sets the selected color.
voidsetSelectedColor(String selcolor)
This is an overloaded version for convenience.
voidsetTipText(String tip)
Specifies what text to display when tooltips are turned on.
voidsetUnderline(boolean on)
Turns on or off the underlining.
voidsetUnderline()
voidsetURL(String url)
Sets the URL for this label to url.
voidsetUseCursor(boolean on, QCursor cursor)
Turns the custom cursor feature on or off.
voidsetUseCursor(boolean on)
voidsetUseTips(boolean on)
Turns on or off the tool tip feature.
voidsetUseTips()
StringtipText()
Returns the current tooltip text.
Stringurl()
Returns the URL.
booleanuseCursor()
booleanuseTips()

Constructor Detail

KURLLabel

protected KURLLabel(Class dummy)

KURLLabel

public KURLLabel(QWidget parent, String name)
Default constructor. Use setURL() and setText() or QListView.setPixmap() to set the resp. properties.

UNKNOWN: Default constructor.

KURLLabel

public KURLLabel(QWidget parent)

KURLLabel

public KURLLabel()

KURLLabel

public KURLLabel(String url, String text, QWidget parent, String name)
Convenience constructor.

Parameters: url is the URL emitted when the label is clicked. text is the displayed string. If it's equal to null the url will be used instead. parent Passed to lower level constructor name Passed to lower level constructor parent and name are passed to QLabel, which in turn passes them further down

UNKNOWN: Convenience constructor.

KURLLabel

public KURLLabel(String url, String text, QWidget parent)

KURLLabel

public KURLLabel(String url, String text)

KURLLabel

public KURLLabel(String url)

Method Detail

altPixmap

public QPixmap altPixmap()

Returns: the alternate pixmap (may be 0L if none was set).

UNKNOWN:

className

public String className()

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

enterEvent

protected void enterEvent(QEvent arg1)
Overridden for internal reasons; the API remains unaffected.

UNKNOWN: Overridden for internal reasons; the API remains unaffected.

event

public boolean event(QEvent e)
Catch parent palette changes

UNKNOWN: Catch parent palette changes

finalize

protected void finalize()
Deletes the wrapped C++ instance

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

isFloatEnabled

public boolean isFloatEnabled()
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.

UNKNOWN: 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.

isGlowEnabled

public boolean isGlowEnabled()
When this is on, the text will switch to the selected color whenever the mouse passes over it.

UNKNOWN: When this is on, the text will switch to the selected color whenever the mouse passes over it.

leaveEvent

protected void leaveEvent(QEvent arg1)
Overridden for internal reasons; the API remains unaffected.

UNKNOWN: Overridden for internal reasons; the API remains unaffected.

metaObject

public QMetaObject metaObject()

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent arg1)
Overridden for internal reasons; the API remains unaffected.

UNKNOWN: Overridden for internal reasons; the API remains unaffected.

setAltPixmap

public void setAltPixmap(QPixmap altPix)
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.

See Also: KURLLabel

UNKNOWN: Sets the "alt" pixmap.

setFloat

public void setFloat(boolean do_float)
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 false.

UNKNOWN: Turns on or off the "float" feature.

setFloat

public void setFloat()

setFont

public void setFont(QFont arg1)
Overridden for internal reasons; the API remains unaffected.

UNKNOWN: Overridden for internal reasons; the API remains unaffected.

setGlow

public void setGlow(boolean glow)
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 true.

UNKNOWN: Turns on or off the "glow" feature.

setGlow

public void setGlow()

setHighlightedColor

public void setHighlightedColor(QColor highcolor)
Sets the highlight color. This is the default foreground color (non-selected). By default, it is blue.

UNKNOWN: Sets the highlight color.

setHighlightedColor

public void setHighlightedColor(String highcolor)
This is an overloaded version for convenience.

See Also: KURLLabel

UNKNOWN: This is an overloaded version for convenience.

setSelectedColor

public void setSelectedColor(QColor selcolor)
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 red.

UNKNOWN: Sets the selected color.

setSelectedColor

public void setSelectedColor(String selcolor)
This is an overloaded version for convenience.

See Also: KURLLabel

UNKNOWN: This is an overloaded version for convenience.

setTipText

public void setTipText(String tip)
Specifies what text to display when tooltips are turned on. If this is not used, the tip will default to the URL.

See Also: KURLLabel

UNKNOWN: Specifies what text to display when tooltips are turned on.

setUnderline

public void setUnderline(boolean on)
Turns on or off the underlining. When this is on, the text will be underlined. By default, it is true.

UNKNOWN: Turns on or off the underlining.

setUnderline

public void setUnderline()

setURL

public void setURL(String url)
Sets the URL for this label to url.

See Also: KURLLabel

UNKNOWN: Sets the URL for this label to url.

setUseCursor

public void setUseCursor(boolean on, QCursor cursor)
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.

Parameters: on whether a custom cursor should be displayed. cursor is the custom cursor. null indicates the default "hand cursor".

UNKNOWN: Turns the custom cursor feature on or off.

setUseCursor

public void setUseCursor(boolean on)

setUseTips

public void setUseTips(boolean on)
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 false.

UNKNOWN: Turns on or off the tool tip feature.

setUseTips

public void setUseTips()

tipText

public String tipText()
Returns the current tooltip text.

UNKNOWN: Returns the current tooltip text.

url

public String url()
Returns the URL.

UNKNOWN: Returns the URL.

useCursor

public boolean useCursor()

Returns: true if the cursor will change while over the URL.

See Also: KURLLabel

UNKNOWN:

useTips

public boolean useTips()

Returns: true if a tooltip will be displayed.

See Also: KURLLabel

UNKNOWN: