ElidedLabel Class Reference

A specialized QLabel that displays an ellipsis when its text is larger than the label width. More...

#include <ElidedLabel.h>

List of all members.

Public Member Functions

 ElidedLabel (QWidget *pParent=NULL)
 ElidedLabel (const QString &text, QWidget *pParent=NULL)
virtual ~ElidedLabel ()
void setElideMode (Qt::TextElideMode mode)
Qt::TextElideMode getElideMode () const

Protected Member Functions

virtual void paintEvent (QPaintEvent *pEvent)


Detailed Description

A specialized QLabel that displays an ellipsis when its text is larger than the label width.

If the text string displayed in the label is longer than the width of the label, an ellipsis is drawn based on the elide mode returned by getElideMode(). To allow the label to resize smaller than the text string, a minimum size must be set (e.g. QWidget::setMimimumWidth()).

Warning:
With an ElidedLabel, when determining whether the text should be elided, the QLabel word wrap property is ignored.
See also:
ElidedButton

Definition at line 29 of file ElidedLabel.h.


Constructor & Destructor Documentation

ElidedLabel::ElidedLabel ( QWidget *  pParent = NULL  ) 

Creates a new elided label with a default elide mode of Qt::ElideLeft.

Parameters:
pParent The parent widget.
See also:
setElideMode()

ElidedLabel::ElidedLabel ( const QString &  text,
QWidget *  pParent = NULL 
)

Creates a new elided label with initial text and a default elide mode of Qt::ElideLeft.

Parameters:
text The text string to display in the label.
pParent The parent widget.
See also:
setElideMode()

virtual ElidedLabel::~ElidedLabel (  )  [virtual]

Destroys the label.


Member Function Documentation

void ElidedLabel::setElideMode ( Qt::TextElideMode  mode  ) 

Sets the position in the text of the ellipsis that is drawn when the text is longer the label width.

Parameters:
mode The new ellipsis position within the text.

Qt::TextElideMode ElidedLabel::getElideMode (  )  const

Returns the position in the text of the ellipsis that is drawn when the text is longer the label width.

Returns:
The current ellipsis position within the text.

virtual void ElidedLabel::paintEvent ( QPaintEvent *  pEvent  )  [protected, virtual]

Draws the label and its text.

The default implementation draws an ellipsis based on the elide mode returned by getElideMode() if the text string is longer than the label width. Otherwise, the QLabel base class implementation is called.

Parameters:
pEvent The paint event.


Software Development Kit - Opticks 4.9.0 Build 16218