The QToolButton class provides a push button whose appearance has been tailored for use in a QToolBar. More...
#include <qtoolbutton.h>
Inherits QButton.
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 |
A QToolButton is a special case of a QPushButton which should be used in QToolBars. A tool button normally contains an icon and optionally a text label. By default only the icon is shown, but this can be changed using setUsesTextLabel(). (See also QMainWindow::setUsesTextLabel()). But it's suggested always to set a text label (see setTextLabel()) for a QToolButton.
As a tool bar can either show tool buttons with small or large icons, QToolButton supports that too. So, using setUsesBigPixmap() it can be specified which size of icons the button should show (see also QMainWindow::setUsesBigPixmap()). So as the tool button has to support different sizes of icons, it doesn't take a single QPixmap but a QIconSet instead when specifying the icon (see setIconSet()).
A QToolButton also supports auto-raising. This means normally the button just shows the pixmap (and optionally the text label), but no raised frame. Only if the user moves the mouse cursor over the button, a raised frame is drawn. This behaviour can be controlled with setAutoRaise().
A tool button can also be used to show a popup menu. You can set the popup menu using setPopup(). By default the popup shows up 600 ms after the user pressed the button, if you want to change that delay, use setPopupDelay().
See also: QPushButton, QToolBar, QMainWindow and GUI Design Handbook: Push Button
Constructs an empty tool button.
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.
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.
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.
Destroys the object and frees any allocated resources.
Returns whether auto-raising is enabled or not.
See also: setAutoRaise.
[virtual protected]
Draws the edges and decoration of the button (pretty much nothing) and calls drawButtonLabel().
See also: drawButtonLabel() and QButton::paintEvent().
Reimplemented from QButton.
[virtual protected]
Draws the contents of the button (pixmap and optionally text).
See also: drawButton() and QButton::paintEvent().
Reimplemented from QButton.
[virtual protected]
Reimplemented to handle the automatic 3D effects in Windows style.
Reimplemented from QWidget.
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.
[virtual protected]
Reimplemented to handle the automatic 3D effects in Windows style.
Reimplemented from QWidget.
[virtual protected]
Reimplemented to handle pseudo transparency in case the toolbars has a fancy pixmap background.
Reimplemented from QWidget.
Returns the icon set which is used if the toolbutton is in off-state.
See also: iconSet().
Returns the icon set which is used if the toolbutton is in on-state.
See also: iconSet().
Returns the associated popup menu or 0 if no popup menu has been defined.
See also: setPopup().
Returns the delay between pressing the button and the appearance of the associated popupmenu in milliseconds.
See also: setPopupDelay() and setPopup().
Enables or disables auto-raising according to enable. The default is TRUE.
See also: autoRaise.
[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().
Sets the icon that is used when the button is in off-state.
See also: setIconSet.
[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().
Sets the icon that is used when the button is in on-state.
See also: setIconSet.
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().
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().
[slot]
Sets the label of this button to newLabel, and automatically sets it as tool tip too.
[virtual slot]
Sets the label of this button to newLabel, and automatically sets it as tool tip too if tipToo is TRUE.
[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().
[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.
[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.
[virtual]
Returns a size suitable for this tool button. This depends on GUI style, usesBigPixmap(), textLabel() and usesTextLabel().
Reimplemented from QWidget.
[virtual]
Specifies that this widget may grow.
Reimplemented from QWidget.
Returns the text label in use by this tool button, or 0.
See also: setTextLabel(), usesTextLabel(), setUsesTextLabel() and setText().
[slot]
Toggles the state of this tool button.
This function has no effect on non-toggling buttons.
See also: isToggleButton() and toggle().
[protected]
Returns TRUE if this button should be drawn using raised edges.
See also: drawButton().
Returns TRUE if this tool button uses the big (32-pixel) pixmaps, and FALSE if it does not.
See also: setUsesBigPixmap(), setPixmap() and usesTextLabel.
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().
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-2000 Troll Tech, all rights reserved.
Copyright İ 2000 Troll Tech | Trademarks | Qt version 2.1.0-beta1
|