|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.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
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.
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)
This property holds areas where the toolbar may be placed. |
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.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 |
---|
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.
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.
allowedAreas
.
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.
iconSize
, and QMainWindow::iconSize
.
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.
movable
.
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.
orientation
.
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.
toolButtonStyle
, and QMainWindow::toolButtonStyle
.
Constructor Detail |
---|
public QToolBar()
QToolBar
with the given parent.
public QToolBar(QWidget parent)
QToolBar
with the given parent.
public QToolBar(java.lang.String title)
QToolBar
with the given parent. The given window title identifies the toolbar and is shown in the context menu provided by QMainWindow
.
public QToolBar(java.lang.String title, QWidget parent)
QToolBar
with the given parent. The given window title identifies the toolbar and is shown in the context menu provided by QMainWindow
.
Method Detail |
---|
public final QAction actionAt(QPoint p)
QWidget::childAt()
.
public final QAction actionAt(int x, int y)
public final QAction addAction(QIcon icon, java.lang.String text)
public final QAction addAction(java.lang.String text)
public final QAction addSeparator()
insertSeparator()
.
public final QAction addWidget(QWidget widget)
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.
insertWidget()
.
public final Qt.ToolBarAreas allowedAreas()
Qt::AllToolBarAreas
. This property only makes sense if the toolbar is in a QMainWindow
.
movable
.
public final void clear()
removeAction()
.
public final QSize iconSize()
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)
addSeparator()
.
public final QAction insertWidget(QAction before, QWidget widget)
Note: You should use QAction::setVisible()
to change the visibility of the widget. Using QWidget::setVisible()
, QWidget::show()
and QWidget::hide()
does not work.
addWidget()
.
public final boolean isAreaAllowed(Qt.ToolBarArea area)
public final boolean isFloatable()
public final boolean isFloating()
QWidget::isWindow()
.
public final boolean isMovable()
This property only makes sense if the toolbar is in a QMainWindow
.
allowedAreas
.
public final Qt.Orientation orientation()
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)
Qt::AllToolBarAreas
. This property only makes sense if the toolbar is in a QMainWindow
.
movable
.
public final void setAllowedAreas(Qt.ToolBarAreas areas)
Qt::AllToolBarAreas
. This property only makes sense if the toolbar is in a QMainWindow
.
movable
.
public final void setFloatable(boolean floatable)
public final void setIconSize(QSize iconSize)
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)
This property only makes sense if the toolbar is in a QMainWindow
.
allowedAreas
.
public final void setOrientation(Qt.Orientation orientation)
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)
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
.
public final QAction toggleViewAction()
The action's text is set to the toolbar's window title.
QAction::text
, and QWidget::windowTitle
.
public final Qt.ToolButtonStyle toolButtonStyle()
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
.
public final QWidget widgetForAction(QAction action)
addWidget()
.
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)
QAction.triggered
signal is connected to member in receiver.
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)
QAction.triggered
signal is connected to member in receiver.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |