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 shows an icon instead. 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().
.PP
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 mouse pointer is hovering over it.
.PP
The button's look and dimension is adjustable with setUsesBigPixmap() and setUsesTextLabel(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow's settings (see QMainWindow::setUsesTextLabel() and QMainWindow::setUsesBigPixmaps()). The pixmap set on a QToolButton will be set to 22x22 if it is bigger than this size. If usesBigPixmap() is TRUE, then the pixmap will be set to 32x32.
.PP
A tool button can offer additional choices in a popup menu. The feature is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list of possible pages to jump to. With QToolButton you can set a popup menu using setPopup(). The default delay is 600ms; you can adjust it with setPopupDelay().
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center> QToolbar with QToolbuttons
.PP
See also QPushButton, QToolBar, QMainWindow, GUI Design Handbook: Push Button, and Basic Widgets.
.SS "Member Type Documentation"
.SH "QToolButton::TextPosition"
The position of the tool button's textLabel in relation to the tool button's icon.
.TP
\fCQToolButton::BesideIcon\fR - The text appears beside the icon.
.TP
\fCQToolButton::BelowIcon\fR - The text appears below the icon.
Constructs a tool button called \fIname\fR, that is a child of \fIparent\fR (which must be a QToolBar).
.PP
The tool button will display \fIiconSet\fR, with its text label and tool tip set to \fItextLabel\fR and its status bar message set to \fIgrouptext\fR. It will be connected to the \fIslot\fR in object \fIreceiver\fR.
Constructs a tool button as an arrow button. The ArrowType \fItype\fR defines the arrow direction. Possible values are LeftArrow, RightArrow, UpArrow and DownArrow.
.PP
An arrow button has auto-repeat turned on by default.
.PP
The \fIparent\fR and \fIname\fR arguments are sent to the QWidget constructor.
.SH "QToolButton::~QToolButton ()"
Destroys the object and frees any allocated resources.
.SH "bool QToolButton::autoRaise () const"
Returns TRUE if auto-raising is enabled; otherwise returns FALSE. See the "autoRaise" property for details.
.SH "QIconSet QToolButton::iconSet () const"
Returns the icon set providing the icon shown on the button. See the "iconSet" property for details.
.SH "QIconSet QToolButton::iconSet ( bool on ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
For ease of porting, this function ignores the \fIon\fR parameter and returns the iconSet property. If you relied on the \fIon\fR parameter, you probably want to update your code to use the QIconSet On/Off mechanism.
.SH "QIconSet QToolButton::offIconSet () const"
Returns the icon set that is used when the button is in an "off" state. See the "offIconSet" property for details.
.SH "QIconSet QToolButton::onIconSet () const"
Returns the icon set that is used when the button is in an "on" state. See the "onIconSet" property for details.
.SH "void QToolButton::openPopup ()"
Opens (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.
.SH "QPopupMenu * QToolButton::popup () const"
Returns the associated popup menu, or 0 if no popup menu has been defined.
.PP
See also setPopup().
.SH "int QToolButton::popupDelay () const"
Returns the time delay between pressing the button and the appearance of the associated popup menu in milliseconds. See the "popupDelay" property for details.
For ease of porting, this function ignores the \fIon\fR parameter and sets the iconSet property. If you relied on the \fIon\fR parameter, you probably want to update your code to use the QIconSet On/Off mechanism.
Associates the popup menu \fIpopup\fR with this tool button.
.PP
The popup will be shown each time the tool button has been pressed down for a certain amount of time. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply browses back to the previous page. If the user presses and holds the button down for a while, the tool button shows a menu containing the current history list.
.PP
Ownership of the popup menu is not transferred to the tool button.
.PP
See also popup().
.SH "void QToolButton::setPopupDelay ( int delay )"
Sets the time delay between pressing the button and the appearance of the associated popup menu in milliseconds to \fIdelay\fR. See the "popupDelay" property for details.
Since TQt 3.0, QIconSet contains both the On and Off icons. There is now an QToolButton::iconSet property that replaces both QToolButton::onIconSet and QToolButton::offIconSet.
For ease of porting, this property is a synonym for QToolButton::iconSet. You probably want to go over your application code and use the QIconSet On/Off mechanism.
.PP
See also iconSet and QIconSet::State.
.PP
Set this property's value with setOffIconSet() and get this property's value with offIconSet().
.SH "bool on"
This property holds whether this tool button is on.
.PP
This property has no effect on non-toggling buttons. The default is FALSE (i.e. off).
.PP
See also toggleButton and toggle().
.PP
Set this property's value with setOn().
.SH "QIconSet onIconSet"
This property holds the icon set that is used when the button is in an "on" state.
.PP
\fBThis property is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
Since TQt 3.0, QIconSet contains both the On and Off icons. There is now an QToolButton::iconSet property that replaces both QToolButton::onIconSet and QToolButton::offIconSet.
For ease of porting, this property is a synonym for QToolButton::iconSet. You probably want to go over your application code and use the QIconSet On/Off mechanism.
.PP
See also iconSet and QIconSet::State.
.PP
Set this property's value with setOnIconSet() and get this property's value with onIconSet().
.SH "QPixmap pixmap"
This property holds the pixmap of the button.
.PP
The pixmap property has no meaning for tool buttons. Use the iconSet property instead.
.SH "int popupDelay"
This property holds the time delay between pressing the button and the appearance of the associated popup menu in milliseconds.
.PP
Usually this is around half a second. A value of 0 draws the down arrow button to the side of the button which can be used to open up the popup menu.
.PP
See also setPopup().
.PP
Set this property's value with setPopupDelay() and get this property's value with popupDelay().
.SH "QString textLabel"
This property holds the label of this button.
.PP
Setting this property automatically sets the text as a tool tip too. There is no default text.
.PP
Set this property's value with setTextLabel() and get this property's value with textLabel().
.SH "TextPosition textPosition"
This property holds the position of the text label of this button.
.PP
Set this property's value with setTextPosition() and get this property's value with textPosition().
.SH "bool toggleButton"
This property holds whether this tool button is a toggle button.
.PP
Toggle buttons have an on/off state similar to check boxes. A tool button is not a toggle button by default.
.PP
See also on and toggle().
.PP
Set this property's value with setToggleButton().
.SH "bool usesBigPixmap"
This property holds whether this toolbutton uses big pixmaps.
.PP
QToolButton automatically connects this property to the relevant signal in the QMainWindow in which it resides. We strongly recommend that you use QMainWindow::setUsesBigPixmaps() instead.
.PP
This property's default is TRUE.
.PP
\fBWarning:\fR If you set some buttons (in a QMainWindow) to have big pixmaps and others to have small pixmaps, QMainWindow may not get the geometry right.
.PP
Set this property's value with setUsesBigPixmap() and get this property's value with usesBigPixmap().
.SH "bool usesTextLabel"
This property holds whether the toolbutton displays a text label below the button pixmap.
.PP
The default is FALSE.
.PP
QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.
.PP
Set this property's value with setUsesTextLabel() and get this property's value with usesTextLabel().