Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QToolBar

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QWidget
                          com.trolltech.qt.gui.QToolBar

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface

    public class QToolBar

extends QWidget

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.

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

When a toolbar is resized in such a way that it is too small to show all the items it contains, an extension button will appear as the last item in the toolbar. Pressing the extension button will pop up a menu containing the items that does not currently fit in the toolbar.

When a QToolBar is not a child of a `QMainWindow`, it looses the ability to populate the extension pop up with widgets added to the toolbar using `addWidget()`. Please use widget actions created by inheriting `QWidgetAction` and implementing `QWidgetAction::createWidget()` instead. This is a known issue which will be fixed in a future release.

See also:
  `QToolButton`, `QMenu`, `QAction`, and Application Example.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
`QWidget.RenderFlag, QWidget.RenderFlags`

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal1` | `actionTriggered` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `allowedAreasChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `iconSizeChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `movableChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `orientationChanged` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `toolButtonStyleChanged` This signal takes 1 generic argument(s).

Fields inherited from class com.trolltech.qt.gui.QWidget
`customContextMenuRequested`

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QToolBar()` Constructs a QToolBar with the given `parent`.
`QToolBar(QWidget parent)` Constructs a QToolBar with the given `parent`.
`QToolBar(java.lang.String title)` Constructs a QToolBar with the given `parent`.
`QToolBar(java.lang.String title, QWidget parent)` Constructs a QToolBar with the given `parent`.

Method Summary
`QAction` | `actionAt(int x, int y)` Returns the action at the point `x`, `y`.
`QAction` | `actionAt(QPoint p)` Returns the action at point `p`.
`QAction` | `addAction(QIcon icon, java.lang.String text)` Creates a new action with the given `icon` and `text`.
`QAction` | `addAction(QIcon icon, java.lang.String text, java.lang.Object receiver, java.lang.String method)` Creates a new action with the icon `icon` and text `text`.
`QAction` | `addAction(QIcon icon, java.lang.String text, QSignalEmitter.AbstractSignal signal)` Creates a new action with the icon `icon` and text `text`.
`QAction` | `addAction(java.lang.String text)` Creates a new action with the given `text`.
`QAction` | `addAction(java.lang.String text, java.lang.Object receiver, java.lang.String method)` Creates a new action with text `text`.
`QAction` | `addAction(java.lang.String text, QSignalEmitter.AbstractSignal signal)` Creates a new action with the given `text`.
`QAction` | `addSeparator()` Adds a separator to the end of the toolbar.
`QAction` | `addWidget(QWidget widget)` Adds the given `widget` to the toolbar as the toolbar's last item.
`Qt.ToolBarAreas` | `allowedAreas()` This property holds areas where the toolbar may be placed.
`void` | `clear()` Removes all actions from the toolbar.
`QSize` | `iconSize()` This property holds size of icons in the toolbar.
`protected void` | `initStyleOption(QStyleOptionToolBar option)` Initialize `option` with the values from the menu bar and information from action.
`QAction` | `insertSeparator(QAction before)` Inserts a separator into the toolbar in front of the toolbar item associated with the `before` action.
`QAction` | `insertWidget(QAction before, QWidget widget)` Inserts the given `widget` in front of the toolbar item associated with the `before` action.
`boolean` | `isAreaAllowed(Qt.ToolBarArea area)` Returns true if this toolbar is dockable in the given `area`; otherwise returns false.
`boolean` | `isFloatable()` This property holds whether the toolbar can be dragged and dropped as an independent window.
`boolean` | `isFloating()` This property holds whether the toolbar is an independent window.
`boolean` | `isMovable()` This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.
`Qt.Orientation` | `orientation()` This property holds orientation of the toolbar.
`void` | `setAllowedAreas(Qt.ToolBarArea[] areas)`
`void` | `setAllowedAreas(Qt.ToolBarAreas areas)` This property holds areas where the toolbar may be placed.
`void` | `setFloatable(boolean floatable)` This property holds whether the toolbar can be dragged and dropped as an independent window.
`void` | `setIconSize(QSize iconSize)` This property holds size of icons in the toolbar.
`void` | `setMovable(boolean movable)` This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas.
`void` | `setOrientation(Qt.Orientation orientation)` This property holds orientation of the toolbar.
`void` | `setToolButtonStyle(Qt.ToolButtonStyle toolButtonStyle)` This property holds the style of toolbar buttons.
`QAction` | `toggleViewAction()` Returns a checkable action that can be used to show or hide this toolbar.
`Qt.ToolButtonStyle` | `toolButtonStyle()` This property holds the style of toolbar buttons.
`QWidget` | `widgetForAction(QAction action)` Returns the widget associated with the specified `action`.

Methods inherited from class com.trolltech.qt.gui.QWidget
`acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y`

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### actionTriggered

    public final QSignalEmitter.Signal1 actionTriggered

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QAction(named: action)>:

  This signal is emitted when an action in this toolbar is triggered. This happens when the action's tool button is pressed, or when the action is triggered in some other way outside the tool bar. The parameter holds the triggered `action`.

### allowedAreasChanged

    public final QSignalEmitter.Signal1 allowedAreasChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.core.Qt$ToolBarAreas(named: allowedAreas)>:

  This signal is emitted when the collection of allowed areas for the toolbar is changed. The new areas in which the toolbar can be positioned are specified by `allowedAreas`.

See also:
  `allowedAreas`.

### iconSizeChanged

    public final QSignalEmitter.Signal1 iconSizeChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.core.QSize(named: iconSize)>:

  This signal is emitted when the icon size is changed. The `iconSize` parameter holds the toolbar's new icon size.

See also:
  `iconSize`, and `QMainWindow::iconSize`.

### movableChanged

    public final QSignalEmitter.Signal1 movableChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Boolean(named: movable)>:

  This signal is emitted when the toolbar becomes movable or fixed. If the toolbar can be moved, `movable` is true; otherwise it is false.

See also:
  `movable`.

### orientationChanged

    public final QSignalEmitter.Signal1 orientationChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.core.Qt$Orientation(named: orientation)>:

  This signal is emitted when the orientation of the toolbar changes. The new orientation is specified by the `orientation` given.

See also:
  `orientation`.

### toolButtonStyleChanged

    public final QSignalEmitter.Signal1 toolButtonStyleChanged

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.core.Qt$ToolButtonStyle(named: toolButtonStyle)>:

  This signal is emitted when the tool button style is changed. The `toolButtonStyle` parameter holds the toolbar's new tool button style.

See also:
  `toolButtonStyle`, and `QMainWindow::toolButtonStyle`.

Constructor Detail

### QToolBar

    public QToolBar()

  Constructs a QToolBar with the given `parent`.

### QToolBar

    public QToolBar(QWidget parent)

  Constructs a QToolBar with the given `parent`.

### QToolBar

    public QToolBar(java.lang.String title)

  Constructs a QToolBar with the given `parent`.

  The given window `title` identifies the toolbar and is shown in the context menu provided by `QMainWindow`.

See also:
  setWindowTitle().

### QToolBar

    public QToolBar(java.lang.String title,
                    QWidget parent)

  Constructs a QToolBar with the given `parent`.

  The given window `title` identifies the toolbar and is shown in the context menu provided by `QMainWindow`.

See also:
  setWindowTitle().

Method Detail

### actionAt

    public final QAction actionAt(QPoint p)

  Returns the action at point `p`. This function returns zero if no action was found.

See also:
  `QWidget::childAt()`.

### actionAt

    public final QAction actionAt(int x,
                                  int y)

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

### addAction

    public final QAction addAction(QIcon icon,
                                   java.lang.String text)

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

### addAction

    public final QAction addAction(java.lang.String text)

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

### addSeparator

    public final QAction addSeparator()

  Adds a separator to the end of the toolbar.

See also:
  `insertSeparator()`.

### addWidget

    public final QAction addWidget(QWidget widget)

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

  The toolbar takes ownership of `widget`.

  If you add a `QToolButton` with this method, the tools bar's `Qt::ToolButtonStyle` will not be respected.

  Note: You should use `QAction::setVisible()` to change the visibility of the widget. Using `QWidget::setVisible()`, `QWidget::show()` and `QWidget::hide()` does not work.

See also:
  `insertWidget()`.

### allowedAreas

    public final Qt.ToolBarAreas allowedAreas()

  This property holds areas where the toolbar may be placed. The default is `Qt::AllToolBarAreas` .

  This property only makes sense if the toolbar is in a `QMainWindow`.

See also:
  `movable`.

### clear

    public final void clear()

  Removes all actions from the toolbar.

See also:
  `removeAction()`.

### iconSize

    public final QSize iconSize()

  This property holds size of icons in the toolbar. The default size is determined by the application's style and is derived from the `QStyle::PM_ToolBarIconSize` pixel metric. It is the maximum size an icon can have. Icons of smaller size will not be scaled up.

### insertSeparator

    public final QAction insertSeparator(QAction before)

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

See also:
  `addSeparator()`.

### insertWidget

    public final QAction insertWidget(QAction before,
                                      QWidget widget)

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

  Note: You should use `QAction::setVisible()` to change the visibility of the widget. Using `QWidget::setVisible()`, `QWidget::show()` and `QWidget::hide()` does not work.

See also:
  `addWidget()`.

### isAreaAllowed

    public final boolean isAreaAllowed(Qt.ToolBarArea area)

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

### isFloatable

    public final boolean isFloatable()

  This property holds whether the toolbar can be dragged and dropped as an independent window. The default is true.

### isFloating

    public final boolean isFloating()

  This property holds whether the toolbar is an independent window. By default, this property is true.

See also:
  `QWidget::isWindow()`.

### isMovable

    public final boolean isMovable()

  This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas. By default, this property is true.

  This property only makes sense if the toolbar is in a `QMainWindow`.

See also:
  `allowedAreas`.

### orientation

    public final Qt.Orientation orientation()

  This property holds orientation of the toolbar. The default is `Qt::Horizontal` .

  This function should not be used when the toolbar is managed by `QMainWindow`. You can use `QMainWindow::addToolBar()` or `QMainWindow::insertToolBar()` if you wish to move a toolbar (that is already added to a main window) to another `Qt::ToolBarArea` .

### setAllowedAreas

    public final void setAllowedAreas(Qt.ToolBarArea[] areas)

### setAllowedAreas

    public final void setAllowedAreas(Qt.ToolBarAreas areas)

  This property holds areas where the toolbar may be placed. The default is `Qt::AllToolBarAreas` .

  This property only makes sense if the toolbar is in a `QMainWindow`.

See also:
  `movable`.

### setFloatable

    public final void setFloatable(boolean floatable)

  This property holds whether the toolbar can be dragged and dropped as an independent window. The default is true.

### setIconSize

    public final void setIconSize(QSize iconSize)

  This property holds size of icons in the toolbar. The default size is determined by the application's style and is derived from the `QStyle::PM_ToolBarIconSize` pixel metric. It is the maximum size an icon can have. Icons of smaller size will not be scaled up.

### setMovable

    public final void setMovable(boolean movable)

  This property holds whether the user can move the toolbar within the toolbar area, or between toolbar areas. By default, this property is true.

  This property only makes sense if the toolbar is in a `QMainWindow`.

See also:
  `allowedAreas`.

### setOrientation

    public final void setOrientation(Qt.Orientation orientation)

  This property holds orientation of the toolbar. The default is `Qt::Horizontal` .

  This function should not be used when the toolbar is managed by `QMainWindow`. You can use `QMainWindow::addToolBar()` or `QMainWindow::insertToolBar()` if you wish to move a toolbar (that is already added to a main window) to another `Qt::ToolBarArea` .

### setToolButtonStyle

    public final void setToolButtonStyle(Qt.ToolButtonStyle toolButtonStyle)

  This property holds the style of toolbar buttons. This property defines the style of all tool buttons that are added as `QAction`s. Note that if you add a `QToolButton` with the `addWidget()` method, it will not get this button style.

  The default is `Qt::ToolButtonIconOnly` .

### toggleViewAction

    public final QAction toggleViewAction()

  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`.

### toolButtonStyle

    public final Qt.ToolButtonStyle toolButtonStyle()

  This property holds the style of toolbar buttons. This property defines the style of all tool buttons that are added as `QAction`s. Note that if you add a `QToolButton` with the `addWidget()` method, it will not get this button style.

  The default is `Qt::ToolButtonIconOnly` .

### widgetForAction

    public final QWidget widgetForAction(QAction action)

  Returns the widget associated with the specified `action`.

See also:
  `addWidget()`.

### initStyleOption

    protected final void initStyleOption(QStyleOptionToolBar option)

  Initialize `option` with the values from the menu bar and information from action. This method is useful for subclasses when they need a QStyleOptionMenuItem, but don't want to fill in all the information themselves.

### addAction

    public final QAction addAction(QIcon icon,
                                   java.lang.String text,
                                   java.lang.Object receiver,
                                   java.lang.String method)

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

  Finally, it returns the created action.

### addAction

    public final QAction addAction(QIcon icon,
                                   java.lang.String text,
                                   QSignalEmitter.AbstractSignal signal)

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

### addAction

    public final QAction addAction(java.lang.String text,
                                   java.lang.Object receiver,
                                   java.lang.String method)

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

### addAction

    public final QAction addAction(java.lang.String text,
                                   QSignalEmitter.AbstractSignal signal)

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD