• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
KURLLabel Class Reference

#include <kurllabel.h>

Inherits TQLabel.

Public Slots

void setUnderline (bool on=true)
 
void setURL (const TQString &url)
 
virtual void setFont (const TQFont &)
 
void setUseTips (bool on=true)
 
void setTipText (const TQString &tip)
 
void setHighlightedColor (const TQColor &highcolor)
 
void setHighlightedColor (const TQString &highcolor)
 
void setSelectedColor (const TQColor &selcolor)
 
void setSelectedColor (const TQString &selcolor)
 
virtual void setCursor (const TQCursor &cursor)
 
virtual void unsetCursor ()
 
void setUseCursor (bool on, TQCursor *cursor=0L)
 
void setGlow (bool glow=true)
 
void setFloat (bool do_float=true)
 
void setAltPixmap (const TQPixmap &altPix)
 

Signals

void enteredURL (const TQString &url)
 
void enteredURL ()
 
void leftURL (const TQString &url)
 
void leftURL ()
 
void leftClickedURL (const TQString &url)
 
void leftClickedURL ()
 
void rightClickedURL (const TQString &url)
 
void rightClickedURL ()
 
void middleClickedURL (const TQString &url)
 
void middleClickedURL ()
 

Public Member Functions

 KURLLabel (TQWidget *parent=0L, const char *name=0L)
 
 KURLLabel (const TQString &url, const TQString &text=TQString::null, TQWidget *parent=0L, const char *name=0L)
 
virtual ~KURLLabel ()
 
const TQString & url () const
 
const TQString & tipText () const
 
bool useTips () const
 
bool useCursor () const
 
bool isGlowEnabled () const
 
bool isFloatEnabled () const
 
const TQPixmap * altPixmap () const
 
virtual void setMargin (int margin)
 
virtual void setFocusPolicy (TQWidget::FocusPolicy policy)
 
virtual void setSizePolicy (TQSizePolicy)
 

Protected Member Functions

virtual void mouseReleaseEvent (TQMouseEvent *e)
 
virtual void enterEvent (TQEvent *)
 
virtual void leaveEvent (TQEvent *)
 
virtual bool event (TQEvent *e)
 
TQRect activeRect () const
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

A drop-in replacement for TQLabel that displays hyperlinks.

KURLLabel is a drop-in replacement for TQLabel 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.

By default KURLLabel accepts focus. When focused, standard focus rectangle is displayed as in HTML widget. Pressing Enter key accepts the focused label.

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, TQ_SIGNAL(leftClickedURL(const TQString&)),
TQ_SLOT(processMyURL(const TQString&)));
KURLLabel
A drop-in replacement for TQLabel that displays hyperlinks.
Definition: kurllabel.h:72
KURLLabel::KURLLabel
KURLLabel(TQWidget *parent=0L, const char *name=0L)
Default constructor.
Definition: kurllabel.cpp:94
KURLLabel::setURL
void setURL(const TQString &url)
Sets the URL for this label to url.
Definition: kurllabel.cpp:178
KURLLabel::leftClickedURL
void leftClickedURL()
Emitted when the user clicked the left mouse button on this label.

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.

KDE URL Label
Author
Kurt Granroth granr.nosp@m.oth@.nosp@m.kde.o.nosp@m.rg (Interface)
Peter Putzer putze.nosp@m.r@kd.nosp@m.e.org (Rewrite)
Version
$Id$

Definition at line 71 of file kurllabel.h.

Constructor & Destructor Documentation

◆ KURLLabel() [1/2]

KURLLabel::KURLLabel ( TQWidget *  parent = 0L,
const char *  name = 0L 
)

Default constructor.

Use setURL() and setText() or TQListView::setPixmap() to set the resp. properties.

Definition at line 94 of file kurllabel.cpp.

◆ KURLLabel() [2/2]

KURLLabel::KURLLabel ( const TQString &  url,
const TQString &  text = TQString::null,
TQWidget *  parent = 0L,
const char *  name = 0L 
)

Convenience constructor.

Parameters
urlis the URL emitted when the label is clicked.
textis the displayed string. If it's equal to TQString::null the url will be used instead.
parentPassed to lower level constructor
namePassed to lower level constructor

parent and name are passed to TQLabel, which in turn passes them further down

Definition at line 82 of file kurllabel.cpp.

◆ ~KURLLabel()

KURLLabel::~KURLLabel ( )
virtual

Destructs the label.

Definition at line 105 of file kurllabel.cpp.

Member Function Documentation

◆ activeRect()

TQRect KURLLabel::activeRect ( ) const
protected

Definition at line 405 of file kurllabel.cpp.

◆ altPixmap()

const TQPixmap * KURLLabel::altPixmap ( ) const
Returns
the alternate pixmap (may be 0L if none was set).

Definition at line 301 of file kurllabel.cpp.

◆ enteredURL [1/2]

void KURLLabel::enteredURL ( )
signal

Emitted when the mouse has passed over the label.

◆ enteredURL [2/2]

void KURLLabel::enteredURL ( const TQString &  url)
signal

Emitted when the mouse has passed over the label.

Parameters
urlThe URL for this label.

◆ enterEvent()

void KURLLabel::enterEvent ( TQEvent *  e)
protectedvirtual

Overridden for internal reasons; the API remains unaffected.

Definition at line 306 of file kurllabel.cpp.

◆ event()

bool KURLLabel::event ( TQEvent *  e)
protectedvirtual

Catch parent palette changes.

Definition at line 352 of file kurllabel.cpp.

◆ isFloatEnabled()

bool KURLLabel::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.

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 291 of file kurllabel.cpp.

◆ isGlowEnabled()

bool KURLLabel::isGlowEnabled ( ) const

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

Definition at line 286 of file kurllabel.cpp.

◆ leaveEvent()

void KURLLabel::leaveEvent ( TQEvent *  e)
protectedvirtual

Overridden for internal reasons; the API remains unaffected.

Definition at line 336 of file kurllabel.cpp.

◆ leftClickedURL [1/2]

void KURLLabel::leftClickedURL ( )
signal

Emitted when the user clicked the left mouse button on this label.

◆ leftClickedURL [2/2]

void KURLLabel::leftClickedURL ( const TQString &  url)
signal

Emitted when the user clicked the left mouse button on this label.

Parameters
urlThe URL for this label.

◆ leftURL [1/2]

void KURLLabel::leftURL ( )
signal

Emitted when the mouse is no longer over the label.

◆ leftURL [2/2]

void KURLLabel::leftURL ( const TQString &  url)
signal

Emitted when the mouse is no longer over the label.

Parameters
urlThe URL for this label.

◆ middleClickedURL [1/2]

void KURLLabel::middleClickedURL ( )
signal

Emitted when the user clicked the left mouse button on this label.

◆ middleClickedURL [2/2]

void KURLLabel::middleClickedURL ( const TQString &  url)
signal

Emitted when the user clicked the middle mouse button on this label.

Parameters
urlThe URL for this label.

◆ mouseReleaseEvent()

void KURLLabel::mouseReleaseEvent ( TQMouseEvent *  e)
protectedvirtual

Overridden for internal reasons; the API remains unaffected.

Definition at line 110 of file kurllabel.cpp.

◆ rightClickedURL [1/2]

void KURLLabel::rightClickedURL ( )
signal

Emitted when the user clicked the right mouse button on this label.

◆ rightClickedURL [2/2]

void KURLLabel::rightClickedURL ( const TQString &  url)
signal

Emitted when the user clicked the right mouse button on this label.

Parameters
urlThe URL for this label.

◆ setAltPixmap

void KURLLabel::setAltPixmap ( const TQPixmap &  altPix)
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' in javascript.

See also
altPixmap()

Definition at line 296 of file kurllabel.cpp.

◆ setCursor

void KURLLabel::setCursor ( const TQCursor &  cursor)
virtualslot

Overridden for internal reasons; the API remains unaffected.

Definition at line 199 of file kurllabel.cpp.

◆ setFloat

void KURLLabel::setFloat ( bool  do_float = true)
slot

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.

Definition at line 281 of file kurllabel.cpp.

◆ setFocusPolicy()

void KURLLabel::setFocusPolicy ( TQWidget::FocusPolicy  policy)
virtual

Reimplemented for internal reasons, the API is not affected.

Definition at line 431 of file kurllabel.cpp.

◆ setFont

void KURLLabel::setFont ( const TQFont &  f)
virtualslot

Overridden for internal reasons; the API remains unaffected.

Definition at line 145 of file kurllabel.cpp.

◆ setGlow

void KURLLabel::setGlow ( bool  glow = true)
slot

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.

Definition at line 276 of file kurllabel.cpp.

◆ setHighlightedColor [1/2]

void KURLLabel::setHighlightedColor ( const TQColor &  highcolor)
slot

Sets the highlight color.

This is the default foreground color (non-selected). By default, it is blue.

Definition at line 250 of file kurllabel.cpp.

◆ setHighlightedColor [2/2]

void KURLLabel::setHighlightedColor ( const TQString &  highcolor)
slot

This is an overloaded version for convenience.

See also
setHighlightedColor()

Definition at line 258 of file kurllabel.cpp.

◆ setMargin()

void KURLLabel::setMargin ( int  margin)
virtual

Reimplemented for internal reasons, the API is not affected.

Definition at line 425 of file kurllabel.cpp.

◆ setSelectedColor [1/2]

void KURLLabel::setSelectedColor ( const TQColor &  selcolor)
slot

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.

Definition at line 263 of file kurllabel.cpp.

◆ setSelectedColor [2/2]

void KURLLabel::setSelectedColor ( const TQString &  selcolor)
slot

This is an overloaded version for convenience.

See also
setSelectedColor()

Definition at line 271 of file kurllabel.cpp.

◆ setSizePolicy()

void KURLLabel::setSizePolicy ( TQSizePolicy  policy)
virtual

Reimplemented for internal reasons, the API is not affected.

Definition at line 439 of file kurllabel.cpp.

◆ setTipText

void KURLLabel::setTipText ( const TQString &  tip)
slot

Specifies what text to display when tooltips are turned on.

If this is not used, the tip will default to the URL.

See also
setUseTips()

Definition at line 233 of file kurllabel.cpp.

◆ setUnderline

void KURLLabel::setUnderline ( bool  on = true)
slot

Turns on or off the underlining.

When this is on, the text will be underlined. By default, it is true.

Definition at line 153 of file kurllabel.cpp.

◆ setURL

void KURLLabel::setURL ( const TQString &  url)
slot

Sets the URL for this label to url.

See also
url

Definition at line 178 of file kurllabel.cpp.

◆ setUseCursor

void KURLLabel::setUseCursor ( bool  on,
TQCursor *  cursor = 0L 
)
slot

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
onwhether a custom cursor should be displayed.
cursoris the custom cursor. 0L indicates the default "hand cursor".

Definition at line 205 of file kurllabel.cpp.

◆ setUseTips

void KURLLabel::setUseTips ( bool  on = true)
slot

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.

Definition at line 223 of file kurllabel.cpp.

◆ tipText()

const TQString & KURLLabel::tipText ( ) const

Returns the current tooltip text.

Definition at line 245 of file kurllabel.cpp.

◆ unsetCursor

void KURLLabel::unsetCursor ( )
virtualslot

Overridden for internal reasons; the API remains unaffected.

Definition at line 193 of file kurllabel.cpp.

◆ url()

const TQString & KURLLabel::url ( ) const

Returns the URL.

Definition at line 188 of file kurllabel.cpp.

◆ useCursor()

bool KURLLabel::useCursor ( ) const
Returns
true if the cursor will change while over the URL.
See also
setUseCursor ()

Definition at line 218 of file kurllabel.cpp.

◆ useTips()

bool KURLLabel::useTips ( ) const
Returns
true if a tooltip will be displayed.
See also
setTipText()

Definition at line 240 of file kurllabel.cpp.

◆ virtual_hook()

void KURLLabel::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 447 of file kurllabel.cpp.


The documentation for this class was generated from the following files:
  • kurllabel.h
  • kurllabel.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.