QToolButton(3qt)

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

SYNOPSIS
#include <ntqtoolbutton.h>

Inherits QButton.

  Public Members
enum TextPosition { BesideIcon, BelowIcon, Right = BesideIcon, Under = BelowIcon }
QToolButton ( TQWidget * parent, const char * name = 0 )
QToolButton ( const QIconSet & iconSet, const TQString & textLabel, const TQString & grouptext, TQObject * receiver, const char * slot, QToolBar * parent, const char * name = 0 )
QToolButton ( ArrowType type, TQWidget * parent, const char * name = 0 )
~QToolButton ()
virtual void setIconSet ( const QIconSet & )
QIconSet iconSet () const
bool usesBigPixmap () const
bool usesTextLabel () const
TQString textLabel () const
void setPopup ( QPopupMenu * popup )
QPopupMenu * popup () const
void setPopupDelay ( int delay )
int popupDelay () const
void openPopup ()
void setAutoRaise ( bool enable )
bool autoRaise () const
TextPosition textPosition () const

  Public Slots
virtual void setUsesBigPixmap ( bool enable )
virtual void setUsesTextLabel ( bool enable )
virtual void setTextLabel ( const TQString & newLabel, bool tipToo )
virtual void setToggleButton ( bool enable )
virtual void setOn ( bool enable )
void toggle ()
void setTextLabel ( const TQString & )
void setTextPosition ( TextPosition pos )

  Properties
bool autoRaise - whether auto-raising is enabled
BackgroundMode backgroundMode - the toolbutton's background mode (read only)
QIconSet iconSet - the icon set providing the icon shown on the button
bool on - whether this tool button is on
QPixmap pixmap - the pixmap of the button (read only)
int popupDelay - the time delay between pressing the button and the appearance of the associated popup menu in milliseconds
TQString textLabel - the label of this button
TextPosition textPosition - the position of the text label of this button
bool toggleButton - whether this tool button is a toggle button
bool usesBigPixmap - whether this toolbutton uses big pixmaps
bool usesTextLabel - whether the toolbutton displays a text label below the button pixmap

  Protected Members
bool uses3D () const

DESCRIPTION
The QToolButton class provides a quick-access button to 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 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().

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.

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.

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().

<center>
[Image Omitted]

</center> QToolbar with QToolbuttons

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

  Member Type Documentation

QToolButton::TextPosition
The position of the tool button's textLabel in relation to the tool button's icon.

QToolButton::BesideIcon - The text appears beside the icon.

QToolButton::BelowIcon - The text appears below the icon.

MEMBER FUNCTION DOCUMENTATION

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

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

The tool button will display iconSet, with its text label and tool tip set to textLabel and its status bar message set to grouptext. It will be connected to the slot in object receiver.

QToolButton::QToolButton ( ArrowType type, TQWidget * parent, const char * name = 0 )
Constructs a tool button as an 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 by default.

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

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

bool QToolButton::autoRaise () const
Returns TRUE if auto-raising is enabled; otherwise returns FALSE. See the "autoRaise" property for details.

QIconSet QToolButton::iconSet () const
Returns the icon set providing the icon shown on the button. See the "iconSet" property for details.

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.

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 time delay between pressing the button and the appearance of the associated popup menu in milliseconds. See the "popupDelay" property for details.

void QToolButton::setAutoRaise ( bool enable )
Sets whether auto-raising is enabled to enable. See the "autoRaise" property for details.

void QToolButton::setIconSet ( const QIconSet & ) [virtual]
Sets the icon set providing the icon shown on the button. See the "iconSet" property for details.

void QToolButton::setOn ( bool enable ) [virtual slot]
Sets whether this tool button is on to enable. See the "on" property for details.

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

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.

Ownership of the popup menu is not transferred to the tool button.

See also popup().

void QToolButton::setPopupDelay ( int delay )
Sets the time delay between pressing the button and the appearance of the associated popup menu in milliseconds to delay. See the "popupDelay" property for details.

void QToolButton::setTextLabel ( const TQString & ) [slot]
Sets the label of this button. See the "textLabel" property for details.

void QToolButton::setTextLabel ( const TQString & newLabel, bool tipToo ) [virtual slot]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the label of this button to newLabel and automatically sets it as a tool tip if tipToo is TRUE.

void QToolButton::setTextPosition ( TextPosition pos ) [slot]
Sets the position of the text label of this button to pos. See the "textPosition" property for details.

void QToolButton::setToggleButton ( bool enable ) [virtual slot]
Sets whether this tool button is a toggle button to enable. See the "toggleButton" property for details.

void QToolButton::setUsesBigPixmap ( bool enable ) [virtual slot]
Sets whether this toolbutton uses big pixmaps to enable. See the "usesBigPixmap" property for details.

void QToolButton::setUsesTextLabel ( bool enable ) [virtual slot]
Sets whether the toolbutton displays a text label below the button pixmap to enable. See the "usesTextLabel" property for details.

TQString QToolButton::textLabel () const
Returns the label of this button. See the "textLabel" property for details.

TextPosition QToolButton::textPosition () const
Returns the position of the text label of this button. See the "textPosition" property for details.

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

This function has no effect on non-toggling buttons.

See also toggleButton and toggled().

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

See also drawButton().

bool QToolButton::usesBigPixmap () const
Returns TRUE if this toolbutton uses big pixmaps; otherwise returns FALSE. See the "usesBigPixmap" property for details.

bool QToolButton::usesTextLabel () const
Returns TRUE if the toolbutton displays a text label below the button pixmap; otherwise returns FALSE. See the "usesTextLabel" property for details.

  Property Documentation

bool autoRaise
This property holds whether auto-raising is enabled.

The default is disabled (i.e. FALSE).

Set this property's value with setAutoRaise() and get this property's value with autoRaise().

BackgroundMode backgroundMode
This property holds the toolbutton's background mode.

Get this property with backgroundMode().

See also TQWidget::backgroundMode.

QIconSet iconSet
This property holds the icon set providing the icon shown on the button.

Setting this property sets QToolButton::pixmap to a null pixmap. There is no default iconset.

See also pixmap, toggleButton, and on.

Set this property's value with setIconSet() and get this property's value with iconSet().

bool on
This property holds whether this tool button is on.

This property has no effect on non-toggling buttons. The default is FALSE (i.e. off).

See also toggleButton and toggle().

Set this property's value with setOn().

QPixmap pixmap
This property holds the pixmap of the button.

The pixmap property has no meaning for tool buttons. Use the iconSet property instead.

int popupDelay
This property holds the time delay between pressing the button and the appearance of the associated popup menu in milliseconds.

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.

See also setPopup().

Set this property's value with setPopupDelay() and get this property's value with popupDelay().

TQString textLabel
This property holds the label of this button.

Setting this property automatically sets the text as a tool tip too. There is no default text.

Set this property's value with setTextLabel() and get this property's value with textLabel().

TextPosition textPosition
This property holds the position of the text label of this button.

Set this property's value with setTextPosition() and get this property's value with textPosition().

bool toggleButton
This property holds whether this tool button is a toggle button.

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

See also on and toggle().

Set this property's value with setToggleButton().

bool usesBigPixmap
This property holds whether this toolbutton uses big pixmaps.

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.

This property's default is TRUE.

Warning: 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.

Set this property's value with setUsesBigPixmap() and get this property's value with usesBigPixmap().

bool usesTextLabel
This property holds whether the toolbutton displays a text label below the button pixmap.

The default is FALSE.

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

Set this property's value with setUsesTextLabel() and get this property's value with usesTextLabel().

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

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, 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 help us to help you. Thank you.

The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqtoolbutton.3qt) and the Qt version (3.3.8).