QToolButton(3qt)

NAME
QToolButton - Quick-access button to specific commands or options, usually used inside a

#include <qtoolbutton.h>

Inherits QButton.

  Public Members
QToolButton ( QWidget * parent, const char * name = 0 )
QToolButton ( const QPixmap & pm, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )
QToolButton ( const QIconSet & s, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )
QToolButton ( ArrowType type, QWidget * parent, const char * name = 0 )
~QToolButton ()
void setOnIconSet ( const QIconSet & )
void setOffIconSet ( const QIconSet & )
QIconSet onIconSet () const
QIconSet offIconSet () const
virtual void setIconSet ( const QIconSet &, bool on = FALSE )
QIconSet iconSet ( bool on = FALSE ) const
bool usesBigPixmap () const
bool usesTextLabel () const
QString textLabel () const
void setPopup ( QPopupMenu * popup )
QPopupMenu* popup () const
void setPopupDelay ( int delay )
int popupDelay () const
void setAutoRaise ( bool enable )
bool autoRaise () const

  Public Slots
virtual void setUsesBigPixmap ( bool enable )
virtual void setUsesTextLabel ( bool enable )
virtual void setTextLabel ( const QString &, bool )
virtual void setToggleButton ( bool enable )
virtual void setOn ( bool enable )
void toggle ()
void setTextLabel ( const QString & )

  Protected Members
bool uses3D () const

  Properties
Type | Name | READ | WRITE | Options
QIconSet | onIconSet | onIconSet | setOnIconSet
QIconSet | offIconSet | offIconSet | setOffIconSet
bool | usesBigPixmap | usesBigPixmap | setUsesBigPixmap
bool | usesTextLabel | usesTextLabel | setUsesTextLabel
QString | textLabel | textLabel | setTextLabel
int | popupDelay | popupDelay | setPopupDelay
bool | autoRaise | autoRaise | setAutoRaise

DESCRIPTION
The QToolButton class provides a quick-access button to specific commands or options, usually used inside a QToolBar.

A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but an icon. Its classic usage is to select tools, for example the "pen"-tool in a drawing program. This would be implemented with a QToolButton as toggle button (see setToggleButton() ).

QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is automatically turned on when a button is used inside a QToolBar. Change it with setAutoRaise().

A tool button's icon is set as QIconSet. This makes it possible to specify different pixmaps for the disabled and active state. The disabled pixmap is used when the button's functionality is not available. The active pixmap is displayed when the button is auto-raised because the user is pointing at it.

The button's look and dimension is adjustable with setUsesBigPixmap() and setUsesTextLabel(). When used inside a QToolBar, the button automatically adjusts to QMainWindow's settings (see QMainWindow::setUsesTextLabel() and QMainWindow::setUsesBigPixmaps()).

A tool button can offer additional choices in a popup menu. The feature is sometimes used with the "Back" button in a web browsers: After pressing the button down for a while, a menu pops up showing all possible pages to browse back. With QToolButton, you can set a popup menu using setPopup(). The default delay is 600ms, you may adjust it with setPopupDelay().

See also QPushButton, QToolBar, QMainWindow and GUI Design Handbook: Push Button

MEMBER FUNCTION DOCUMENTATION

QToolButton::QToolButton ( QWidget * parent, const char * name = 0 )
Constructs an empty tool button.

QToolButton::QToolButton ( ArrowType type, QWidget * parent, const char * name = 0 )
Constructs a tool button as arrow button. The ArrowType type defines the arrow direction. Possible values are LeftArrow, RightArrow, UpArrow and DownArrow.

An arrow button has auto repeat turned on.

The parent and name arguments are sent to the QWidget constructor.

QToolButton::QToolButton ( const QIconSet & iconSet, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )
Constructs a tool button that is a child of parent (which must be a QToolBar) and named name.

The tool button will display iconSet, with text label or tool tip textLabel and status-bar message grouptext, connected to slot in object receiver, and returns the button.

QToolButton::QToolButton ( const QPixmap & pm, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )
Constructs a tool button that is a child of parent (which must be a QToolBar) and named name.

The tool button will display pm, with text label or tool tip textLabel and status-bar message grouptext, connected to slot in object receiver, and returns the button.

QToolButton::~QToolButton ()
Destroys the object and frees any allocated resources.

bool QToolButton::autoRaise () const
Returns whether auto-raising is enabled or not.

See also setAutoRaise.

void QToolButton::drawButton ( QPainter * p ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QButton.

void QToolButton::drawButtonLabel ( QPainter * p ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QButton.

void QToolButton::enterEvent ( QEvent * e ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QIconSet QToolButton::iconSet ( bool on = FALSE ) const
Returns a copy of the icon set in use. If no icon set has been set, iconSet() creates one from the pixmap().

If the button doesn't have a pixmap either, iconSet()'s return value is meaningless.

If on equals TRUE, the special icon set for the on-state of the button is returned.

See also setIconSet() and QIconSet.

void QToolButton::leaveEvent ( QEvent * e ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QToolButton::moveEvent ( QMoveEvent * ) [virtual protected]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QIconSet QToolButton::offIconSet () const
Returns the icon set which is used if the toolbutton is in off-state.

See also iconSet().

QIconSet QToolButton::onIconSet () const
Returns the icon set which is used if the toolbutton is in on-state.

See also iconSet().

QPopupMenu* QToolButton::popup () const
Returns the associated popup menu or 0 if no popup menu has been defined.

See also setPopup().

int QToolButton::popupDelay () const
Returns the delay between pressing the button and the appearance of the associated popupmenu in milliseconds.

See also setPopupDelay() and setPopup().

void QToolButton::setAutoRaise ( bool enable )
Enables or disables auto-raising according to enable.

See also autoRaise.

void QToolButton::setIconSet ( const QIconSet & set, bool on = FALSE ) [virtual]
Sets this tool button to display the icons in set. (setPixmap() is effectively a wrapper for this function.)

For toggle buttons it is possible to set an extra icon set with on equals TRUE, which will be used exclusively for the on-state.

QToolButton makes a copy of set, so you must delete set yourself.

See also iconSet(), QIconSet, setToggleButton() and isOn().

void QToolButton::setOffIconSet ( const QIconSet & set )
Sets the icon that is used when the button is in off-state.

See also setIconSet().

void QToolButton::setOn ( bool enable ) [virtual slot]
Sets this tool button to be on if enable is TRUE, and off it enable is FALSE.

This function has no effect on non-toggling buttons.

See also isToggleButton() and toggle().

void QToolButton::setOnIconSet ( const QIconSet & set )
Sets the icon that is used when the button is in on-state.

See also setIconSet().

void QToolButton::setPopup ( QPopupMenu * popup )
Associates the popup menu popup with this toolbutton.

The popup will be shown each time the toolbutton has been pressed down for a certain amount of time. A typical application example is the "back" button in a web browser's toolbar. If the user clicks it, the browser simply browses back to the previous page. If the user holds the button down for a while, they receive a menu containing the current history list.

Ownership of the popup menu is not transferred.

See also popup().

void QToolButton::setPopupDelay ( int delay )
Sets the time delay between pressing the button and the appearance of the associated popupmenu in milliseconds. Usually this is around 1/2 of a second.

See also popupDelay() and setPopup().

void QToolButton::setTextLabel ( const QString & newLabel ) [slot]
Sets the label of this button to newLabel, and automatically sets it as tool tip too.

void QToolButton::setTextLabel ( const QString & newLabel, bool tipToo ) [virtual slot]
Sets the label of this button to newLabel, and automatically sets it as tool tip too if tipToo is TRUE.

void QToolButton::setToggleButton ( bool enable ) [virtual slot]
Makes the tool button a toggle button if enable is TRUE, or a normal tool button if enable is FALSE.

Toggle buttons have an on/off state similar to check boxes. A tool button is initially not a toggle button.

See also setOn(), toggle(), isToggleButton() and toggled().

void QToolButton::setUsesBigPixmap ( bool enable ) [virtual slot]
Sets this button to use the big pixmaps provided by its QIconSet if enable is TRUE, and to use the small ones else.

QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which it resides. You're strongly urged to use QMainWindow::setUsesBigPixmaps() instead.

Warning: If you set some buttons (in a QMainWindow) to have big and others small pixmaps, QMainWindow may have trouble getting the geometry correct.

void QToolButton::setUsesTextLabel ( bool enable ) [virtual slot]
Sets this button to draw a text label below the icon if enable is TRUE, and to not draw it if enable is FALSE.

QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.

QSize QToolButton::sizeHint () const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QSizePolicy QToolButton::sizePolicy () const [virtual]
Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QString QToolButton::textLabel () const
Returns the text label in use by this tool button, or 0.

See also setTextLabel(), usesTextLabel(), setUsesTextLabel() and setText().

void QToolButton::toggle () [slot]
Toggles the state of this tool button.

This function has no effect on non-toggling buttons.

See also isToggleButton() and toggled().

bool QToolButton::uses3D () const [protected]
Returns TRUE if this button should be drawn using raised edges.

See also drawButton().

bool QToolButton::usesBigPixmap () const
Returns TRUE if this tool button uses the big (32-pixel) pixmaps, and FALSE if it does not.

See also setUsesBigPixmap(), setPixmap() and usesTextLabel.

bool QToolButton::usesTextLabel () const
Returns TRUE if this tool button puts a text label below the button pixmap, and FALSE if it does not.

See also setUsesTextLabel(), setTextLabel() and usesBigPixmap().

SEE ALSO
http://doc.trolltech.com/qtoolbutton.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports make our job much simpler. Thank you.

In case of content or formattting problems with this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qtoolbutton.3qt) and the Qt version (2.3.1).