Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QToolBar Class Reference

The QToolBar class provides a movable panel that contains a set of controls. More...

    #include <QToolBar>

Inherits QWidget.

- List of all members, including inherited members
- Obsolete members
- Compatibility members

### Writable Properties

- movable : bool

- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- 20 read-only properties inherited from QWidget

### Public Functions

- QToolBar ( QWidget * parent = 0 )
- ~QToolBar ()
- QAction * actionAt ( int x, int y ) const
- QAction * actionAt ( const QPoint & p ) const
- void addAction ( QAction * action )
- QAction * addAction ( const QString & text )
- QAction * addAction ( const QIcon & icon, const QString & text )
- QAction * addAction ( const QString & text, const QObject * receiver, const char * member )
- QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member )
- QAction * addSeparator ()
- QAction * addWidget ( QWidget * widget )
- Qt::ToolBarAreas allowedAreas () const
- void clear ()
- Qt::IconSize iconSize () const
- void insertAction ( QAction * before, QAction * action )
- QAction * insertAction ( QAction * before, const QString & text )
- QAction * insertAction ( QAction * before, const QIcon & icon, const QString & text )
- QAction * insertAction ( QAction * before, const QString & text, const QObject * receiver, const char * member )
- QAction * insertAction ( QAction * before, const QIcon & icon, const QString & text, const QObject * receiver, const char * member )
- QAction * insertSeparator ( QAction * before )
- QAction * insertWidget ( QAction * before, QWidget * widget )
- bool isDockable ( Qt::ToolBarArea area )
- Qt::Orientation orientation () const
- void setAllowedAreas ( Qt::ToolBarAreas areas )
- void setOrientation ( Qt::Orientation orientation )
- QAction * toggleViewAction () const
- Qt::ToolButtonStyle toolButtonStyle () const

- 92 public functions inherited from QWidget
- 26 public functions inherited from QObject
- 10 public functions inherited from QPaintDevice

### Public Slots

- void setIconSize ( Qt::IconSize iconSize )
- void setToolButtonStyle ( Qt::ToolButtonStyle toolButtonStyle )

- 16 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void actionTriggered ( QAction * action )
- void iconSizeChanged ( Qt::IconSize iconSize )
- void toolButtonStyleChanged ( Qt::ToolButtonStyle toolButtonStyle )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- 42 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

The QToolBar class provides a movable panel that contains a set of controls.

Toolbar buttons are added by adding actions, using addAction() or insertAction(). Groups of buttons can be separated using addSeparator() or insertSeparator(). If a toolbar button is not appropriate, a widget can be inserted instead using addWidget() or insertWidget(); examples of suitable widgets are QSpinBox, QDoubleSpinBox, and QComboBox. When a toolbar button is pressed it emits the actionTriggered() signal. Toolbars may only be added to QMainWindow and QMainWindow subclasses.

A toolbar can be fixed in place in a particular area() (e.g. at the top of the window), or it can be movable() between toolbar areas, or it can be floatable: see allowedAreas and isDockable().

## Property Documentation

### movable : bool

This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.

By default, this property is true when the toolbar is added to a QMainWindow. This property is always false, and cannot be set to true, when the QToolBar is not added to a QMainWindow.

Access functions:

- bool isMovable () const
- void setMovable ( bool movable = true )

See also QToolBar::allowedAreas.

## Member Function Documentation

### QToolBar::QToolBar ( QWidget * parent = 0 )

Constructs a QToolBar with the given parent.

### QToolBar::~QToolBar ()

Destroys the toolbar.

### QAction * QToolBar::actionAt ( int x, int y ) const

Returns the action at the point x, y. This function returns zero if no action was found.

See also QWidget::childAt().

### QAction * QToolBar::actionAt ( const QPoint & p ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the action at point p.

### void QToolBar::actionTriggered ( QAction * action ) `[signal]`

This signal is emitted when a toolbar button is pressed. The parameter holds the toolbar button's associated action.

### void QToolBar::addAction ( QAction * action )

Adds action to the end of the toolbar.

See also addAction().

### QAction * QToolBar::addAction ( const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with text text. This action is added to the end of the toolbar.

### QAction * QToolBar::addAction ( const QIcon & icon, const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the icon icon and text text. This action is added to the end of the toolbar.

### QAction * QToolBar::addAction ( const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with text text. This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver.

### QAction * QToolBar::addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the icon icon and text text. This action is added to the end of the toolbar. The action's triggered() signal is connected to member in receiver.

### QAction * QToolBar::addSeparator ()

Adds a separator to the end of the toolbar.

See also insertSeparator().

### QAction * QToolBar::addWidget ( QWidget * widget )

Adds the given widget to the toolbar as the toolbar's last item.

See also insertWidget().

### Qt::ToolBarAreas QToolBar::allowedAreas () const

areas where the toolbar may be placed.

The default is `Qt::AllToolBarAreas`.

### void QToolBar::clear ()

Removes all actions from the toolbar.

See also removeAction().

### Qt::IconSize QToolBar::iconSize () const

size of icons in the toolbar.

The default is Qt::AutomaticIconSize.

### void QToolBar::iconSizeChanged ( Qt::IconSize iconSize ) `[signal]`

### void QToolBar::insertAction ( QAction * before, QAction * action )

Inserts the given action into the toolbar in front of the tool bar item associated with the before action.

See also addAction().

### QAction * QToolBar::insertAction ( QAction * before, const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the given text. This action is inserted into the toolbar in front of the toolbar item associated with the before action.

### QAction * QToolBar::insertAction ( QAction * before, const QIcon & icon, const QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the given icon and text. This action is inserted into the toolbar in front of the toolbar item associated with the before action.

### QAction * QToolBar::insertAction ( QAction * before, const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the given text. This action is inserted into the toolbar in front of the toolbar item associated with the before action. The action's triggered() signal is connected to the member in receiver.

### QAction * QToolBar::insertAction ( QAction * before, const QIcon & icon, const QString & text, const QObject * receiver, const char * member )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a new action with the given icon and text. This action is inserted into the toolbar in front of the toolbar item associated with the before action. The action's triggered() signal is connected to the member in the receiver.

### QAction * QToolBar::insertSeparator ( QAction * before )

Inserts a separator into the toolbar in front of the toolbar item associated with the before action.

See also addSeparator().

### QAction * QToolBar::insertWidget ( QAction * before, QWidget * widget )

Inserts the given widget in front of the toolbar item associated with the before action.

See also addWidget().

### bool QToolBar::isDockable ( Qt::ToolBarArea area )

Returns true if this toolbar is dockable in the given area; otherwise returns false.

### Qt::Orientation QToolBar::orientation () const

orientation of the toolbar.

The default is `Qt::Horizontal`.

Note: the orientation is updated automatically when the toolbar is managed by QMainWindow.

### void QToolBar::setAllowedAreas ( Qt::ToolBarAreas areas )

### void QToolBar::setIconSize ( Qt::IconSize iconSize ) `[slot]`

### void QToolBar::setOrientation ( Qt::Orientation orientation )

### void QToolBar::setToolButtonStyle ( Qt::ToolButtonStyle toolButtonStyle ) `[slot]`

### QAction * QToolBar::toggleViewAction () const

Returns a checkable action that can be used to show or hide this toolbar.

The action's text is set to the toolbar's window title.

See also QAction::text and QWidget::windowTitle.

### Qt::ToolButtonStyle QToolBar::toolButtonStyle () const

style of toolbar buttons.

The defaults is Qt::ToolButtonIconOnly.

### void QToolBar::toolButtonStyleChanged ( Qt::ToolButtonStyle toolButtonStyle ) `[signal]`