ElidedButton Class Reference

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

#include <ElidedButton.h>

List of all members.

Public Member Functions

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

Protected Member Functions

virtual void paintEvent (QPaintEvent *pEvent)


Detailed Description

A specialized QPushButton that displays an ellipsis when its text is larger than the button width.

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

See also:
ElidedLabel

Definition at line 26 of file ElidedButton.h.


Constructor & Destructor Documentation

ElidedButton::ElidedButton ( QWidget *  pParent = NULL  ) 

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

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

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

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

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

virtual ElidedButton::~ElidedButton (  )  [virtual]

Destroys the push button.


Member Function Documentation

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

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

Parameters:
mode The new ellipsis position within the text.

Qt::TextElideMode ElidedButton::getElideMode (  )  const

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

Returns:
The current ellipsis position within the text.

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

Draws the push button 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 button width. Otherwise, the QPushButton base class implementation is called.

Parameters:
pEvent The paint event.


Software Development Kit - Opticks 4.9.0 Build 16218