|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QToolBar
public class QToolBar
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.
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<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<QAction> |
actionTriggered
This signal is emitted when an action in this toolbar is triggered. |
QSignalEmitter.Signal1<Qt.ToolBarAreas> |
allowedAreasChanged
This signal is emitted when the collection of allowed areas for the toolbar is changed. |
QSignalEmitter.Signal1<QSize> |
iconSizeChanged
This signal is emitted when the icon size is changed. |
QSignalEmitter.Signal1<java.lang.Boolean> |
movableChanged
This signal is emitted when the toolbar becomes movable or fixed. |
QSignalEmitter.Signal1<Qt.Orientation> |
orientationChanged
This signal is emitted when the orientation of the toolbar changes. |
QSignalEmitter.Signal1<Qt.ToolButtonStyle> |
toolButtonStyleChanged
This signal is emitted when the tool button style is changed. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QToolBar()
Equivalent to QToolBar(0). |
|
QToolBar(QWidget parent)
Constructs a QToolBar with the given parent. |
|
QToolBar(java.lang.String title)
Equivalent to QToolBar(title, 0). |
|
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. |
protected void |
actionEvent(QActionEvent event)
This function is reimplemented for internal reasons. |
QRect |
actionGeometry(QAction action)
|
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 text 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()
Returns areas where the toolbar may be placed. |
protected void |
changeEvent(QEvent event)
This function is reimplemented for internal reasons. |
protected void |
childEvent(QChildEvent event)
This function is reimplemented for internal reasons. |
void |
clear()
Removes all actions from the toolbar. |
boolean |
event(QEvent event)
This function is reimplemented for internal reasons. |
static QToolBar |
fromNativePointer(QNativePointer nativePointer)
This function returns the QToolBar instance pointed to by nativePointer |
QSize |
iconSize()
Returns 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()
Returns whether the toolbar can be dragged and dropped as an independent window.. |
boolean |
isFloating()
Returns whether the toolbar is an independent window.. |
boolean |
isMovable()
Returns whether the user can move the toolbar within the toolbar area, or between toolbar areas. |
Qt.Orientation |
orientation()
Returns orientation of the toolbar. |
protected void |
paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons. |
protected void |
resizeEvent(QResizeEvent event)
This function is reimplemented for internal reasons. |
void |
setAllowedAreas(Qt.ToolBarArea... areas)
Sets areas where the toolbar may be placed to areas. |
void |
setAllowedAreas(Qt.ToolBarAreas areas)
Sets areas where the toolbar may be placed to areas. |
void |
setFloatable(boolean floatable)
Sets whether the toolbar can be dragged and dropped as an independent window. |
void |
setIconSize(QSize iconSize)
Sets size of icons in the toolbar. |
void |
setMovable(boolean movable)
Sets whether the user can move the toolbar within the toolbar area, or between toolbar areas to movable. |
void |
setOrientation(Qt.Orientation orientation)
Sets orientation of the toolbar to orientation. |
void |
setToolButtonStyle(Qt.ToolButtonStyle toolButtonStyle)
Sets the style of toolbar buttons to toolButtonStyle. |
QAction |
toggleViewAction()
Returns a checkable action that can be used to show or hide this toolbar. |
Qt.ToolButtonStyle |
toolButtonStyle()
Returns the style of toolbar buttons. |
QWidget |
widgetForAction(QAction action)
Returns the widget associated with the specified action. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<QAction> actionTriggered
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.
public final QSignalEmitter.Signal1<Qt.ToolBarAreas> allowedAreasChanged
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.
public final QSignalEmitter.Signal1<QSize> iconSizeChanged
This signal is emitted when the icon size is changed. The iconSize parameter holds the toolbar's new icon size.
public final QSignalEmitter.Signal1<java.lang.Boolean> movableChanged
This signal is emitted when the toolbar becomes movable or fixed. If the toolbar can be moved, movable is true; otherwise it is false.
public final QSignalEmitter.Signal1<Qt.Orientation> orientationChanged
This signal is emitted when the orientation of the toolbar changes. The new orientation is specified by the orientation given.
public final QSignalEmitter.Signal1<Qt.ToolButtonStyle> toolButtonStyleChanged
This signal is emitted when the tool button style is changed. The toolButtonStyle parameter holds the toolbar's new tool button style.
Constructor Detail |
---|
public QToolBar(java.lang.String title)
Equivalent to QToolBar(title, 0).
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.
public QToolBar()
Equivalent to QToolBar(0).
public QToolBar(QWidget parent)
Constructs a QToolBar with the given parent.
Method Detail |
---|
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.
public final QAction actionAt(QPoint p)
Returns the action at point p. This function returns zero if no action was found.
public final QRect actionGeometry(QAction action)
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.
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.
public final QAction addSeparator()
Adds a separator to the end of the toolbar.
public final QAction addWidget(QWidget widget)
Adds the given widget to the toolbar as the toolbar's last item.
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.
public final Qt.ToolBarAreas allowedAreas()
Returns areas where the toolbar may be placed.
The default is Qt::AllToolBarAreas.
This property only makes sense if the toolbar is in a QMainWindow.
movable
public final void clear()
Removes all actions from the toolbar.
public final QSize iconSize()
Returns 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.
public final QAction insertSeparator(QAction before)
Inserts a separator into the toolbar in front of the toolbar item associated with the before action.
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.
public final boolean isAreaAllowed(Qt.ToolBarArea area)
Returns true if this toolbar is dockable in the given area; otherwise returns false.
public final boolean isFloatable()
Returns whether the toolbar can be dragged and dropped as an independent window..
The default is true.
public final boolean isFloating()
Returns whether the toolbar is an independent window..
public final boolean isMovable()
Returns 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.
public final Qt.Orientation orientation()
Returns 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.
public final void setAllowedAreas(Qt.ToolBarArea... areas)
Sets areas where the toolbar may be placed to areas.
The default is Qt::AllToolBarAreas.
This property only makes sense if the toolbar is in a QMainWindow.
movable
public final void setAllowedAreas(Qt.ToolBarAreas areas)
Sets areas where the toolbar may be placed to areas.
The default is Qt::AllToolBarAreas.
This property only makes sense if the toolbar is in a QMainWindow.
movable
public final void setFloatable(boolean floatable)
Sets whether the toolbar can be dragged and dropped as an independent window. to floatable.
The default is true.
public final void setIconSize(QSize iconSize)
Sets size of icons in the toolbar. to iconSize.
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.
public final void setMovable(boolean movable)
Sets whether the user can move the toolbar within the toolbar area, or between toolbar areas to movable.
By default, this property is true.
This property only makes sense if the toolbar is in a QMainWindow.
public final void setOrientation(Qt.Orientation orientation)
Sets orientation of the toolbar to orientation.
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.
public final void setToolButtonStyle(Qt.ToolButtonStyle toolButtonStyle)
Sets the style of toolbar buttons to toolButtonStyle.
This property defines the style of all tool buttons that are added as QActions. Note that if you add a QToolButton with the addWidget method, it will not get this button style.
The default is Qt::ToolButtonIconOnly.
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.
public final Qt.ToolButtonStyle toolButtonStyle()
Returns the style of toolbar buttons.
This property defines the style of all tool buttons that are added as QActions. Note that if you add a QToolButton with the addWidget method, it will not get this button style.
The default is Qt::ToolButtonIconOnly.
public final QWidget widgetForAction(QAction action)
Returns the widget associated with the specified action.
protected void actionEvent(QActionEvent event)
This function is reimplemented for internal reasons.
actionEvent
in class QWidget
protected void changeEvent(QEvent event)
This function is reimplemented for internal reasons.
changeEvent
in class QWidget
protected void childEvent(QChildEvent event)
This function is reimplemented for internal reasons.
childEvent
in class QObject
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QWidget
protected void paintEvent(QPaintEvent event)
This function is reimplemented for internal reasons.
paintEvent
in class QWidget
protected void resizeEvent(QResizeEvent event)
This function is reimplemented for internal reasons.
resizeEvent
in class QWidget
Example
public static QToolBar fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionToolBar option)
public final QAction addAction(QIcon icon, java.lang.String text, java.lang.Object receiver, java.lang.String method)
Finally, it returns the created action.
public final QAction addAction(QIcon icon, java.lang.String text, QSignalEmitter.AbstractSignal signal)
public final QAction addAction(java.lang.String text, java.lang.Object receiver, java.lang.String method)
public final QAction addAction(java.lang.String text, QSignalEmitter.AbstractSignal signal)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |