QtBase
v6.3.1
|
The QToolBar class provides a movable panel that contains a set of controls. More...
#include <qtoolbar.h>
Public Slots | |
void | setIconSize (const QSize &iconSize) |
void | setToolButtonStyle (Qt::ToolButtonStyle toolButtonStyle) |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
virtual void | setVisible (bool visible) |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | actionTriggered (QAction *action) |
void | movableChanged (bool movable) |
void | allowedAreasChanged (Qt::ToolBarAreas allowedAreas) |
void | orientationChanged (Qt::Orientation orientation) |
void | iconSizeChanged (const QSize &iconSize) |
void | toolButtonStyleChanged (Qt::ToolButtonStyle toolButtonStyle) |
void | topLevelChanged (bool topLevel) |
void | visibilityChanged (bool visible) |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
bool | movable |
whether the user can move the toolbar within the toolbar area, or between toolbar areas. More... | |
Qt::ToolBarAreas | allowedAreas |
areas where the toolbar may be placed More... | |
Qt::Orientation | orientation |
orientation of the toolbar More... | |
QSize | iconSize |
size of icons in the toolbar. More... | |
Qt::ToolButtonStyle | toolButtonStyle |
the style of toolbar buttons More... | |
bool | floating |
whether the toolbar is an independent window. More... | |
bool | floatable |
whether the toolbar can be dragged and dropped as an independent window. More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Friends | |
class | QMainWindowLayout |
class | QToolBarLayout |
class | QToolBarAreaLayout |
The QToolBar class provides a movable panel that contains a set of controls.
\inmodule QtWidgets
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 between toolbar areas; see setMovable(), isMovable(), 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 do not currently fit in the toolbar.
When a QToolBar is not a child of a QMainWindow, it loses 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.
Definition at line 58 of file qtoolbar.h.
Constructs a QToolBar with the given parent.
The given window title identifies the toolbar and is shown in the context menu provided by QMainWindow.
Definition at line 520 of file qtoolbar.cpp.
Constructs a QToolBar with the given parent.
Definition at line 505 of file qtoolbar.cpp.
QToolBar::~QToolBar | ( | ) |
Destroys the toolbar.
Definition at line 530 of file qtoolbar.cpp.
Returns the action at point p. This function returns zero if no action was found.
Definition at line 831 of file qtoolbar.cpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the action at the point x, y. This function returns zero if no action was found.
Definition at line 157 of file qtoolbar.h.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 850 of file qtoolbar.cpp.
Definition at line 815 of file qtoolbar.cpp.
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 toolbar. The parameter holds the triggered action.
QAction * QWidget::addAction |
Definition at line 598 of file qwidget.cpp.
|
inline |
QAction* QWidget::addAction |
QAction * QWidget::addAction |
Definition at line 597 of file qwidget.cpp.
|
inline |
QAction* QWidget::addAction |
void QWidget::addAction |
Appends the action action to this widget's list of actions.
All QWidgets have a list of \l{QAction}s, however they can be represented graphically in many different ways. The default use of the QAction list (as returned by actions()) is to create a context QMenu.
A QWidget should only have one of each action and adding an action it already has will not cause the same action to be in the widget twice.
The ownership of action is not transferred to this QWidget.
Definition at line 589 of file qwidget.cpp.
QAction * QToolBar::addSeparator | ( | ) |
Adds a separator to the end of the toolbar.
Definition at line 744 of file qtoolbar.cpp.
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 toolbar's Qt::ToolButtonStyle will not be respected.
Definition at line 781 of file qtoolbar.cpp.
Qt::ToolBarAreas QToolBar::allowedAreas | ( | ) | const |
Definition at line 615 of file qtoolbar.cpp.
|
signal |
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.
\reimp
Reimplemented from QWidget.
Definition at line 896 of file qtoolbar.cpp.
void QToolBar::clear | ( | ) |
Removes all actions from the toolbar.
Definition at line 732 of file qtoolbar.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 994 of file qtoolbar.cpp.
QSize QToolBar::iconSize | ( | ) | const |
Definition at line 664 of file qtoolbar.cpp.
This signal is emitted when the icon size is changed. The iconSize parameter holds the toolbar's new icon size.
|
protectedvirtual |
Definition at line 1116 of file qtoolbar.cpp.
Inserts a separator into the toolbar in front of the toolbar item associated with the before action.
Definition at line 758 of file qtoolbar.cpp.
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.
Definition at line 800 of file qtoolbar.cpp.
|
inline |
Returns true
if this toolbar is dockable in the given area; otherwise returns false
.
Definition at line 84 of file qtoolbar.h.
bool QToolBar::isFloatable | ( | ) | const |
Definition at line 568 of file qtoolbar.cpp.
bool QToolBar::isFloating | ( | ) | const |
Definition at line 588 of file qtoolbar.cpp.
bool QToolBar::isMovable | ( | ) | const |
|
signal |
This signal is emitted when the toolbar becomes movable or fixed. If the toolbar can be moved, movable is true; otherwise it is false.
Qt::Orientation QToolBar::orientation | ( | ) | const |
Definition at line 651 of file qtoolbar.cpp.
|
signal |
This signal is emitted when the orientation of the toolbar changes. The orientation parameter holds the toolbar's new orientation.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QWidget.
Definition at line 919 of file qtoolbar.cpp.
void QToolBar::setAllowedAreas | ( | Qt::ToolBarAreas | areas | ) |
Definition at line 605 of file qtoolbar.cpp.
void QToolBar::setFloatable | ( | bool | floatable | ) |
Definition at line 574 of file qtoolbar.cpp.
Definition at line 667 of file qtoolbar.cpp.
void QToolBar::setMovable | ( | bool | movable | ) |
Definition at line 546 of file qtoolbar.cpp.
void QToolBar::setOrientation | ( | Qt::Orientation | orientation | ) |
Definition at line 632 of file qtoolbar.cpp.
|
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.
Definition at line 1090 of file qtoolbar.cpp.
Qt::ToolButtonStyle QToolBar::toolButtonStyle | ( | ) | const |
Definition at line 713 of file qtoolbar.cpp.
|
signal |
This signal is emitted when the tool button style is changed. The toolButtonStyle parameter holds the toolbar's new tool button style.
|
signal |
This signal is emitted when the \l floating property changes. The topLevel parameter is true if the toolbar is now floating; otherwise it is false.
|
signal |
This signal is emitted when the toolbar becomes visible (or invisible). This happens when the widget is hidden or shown.
Returns the widget associated with the specified action.
Definition at line 1100 of file qtoolbar.cpp.
|
friend |
Definition at line 152 of file qtoolbar.h.
|
friend |
Definition at line 154 of file qtoolbar.h.
|
friend |
Definition at line 153 of file qtoolbar.h.
|
readwrite |
areas where the toolbar may be placed
The default is Qt::AllToolBarAreas.
This property only makes sense if the toolbar is in a QMainWindow.
Definition at line 160 of file qtoolbar.h.
|
readwrite |
whether the toolbar can be dragged and dropped as an independent window.
The default is true.
Definition at line 160 of file qtoolbar.h.
|
read |
whether the toolbar is an independent window.
By default, this property is true
.
Definition at line 160 of file qtoolbar.h.
|
readwrite |
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.
Definition at line 160 of file qtoolbar.h.
|
readwrite |
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.
Definition at line 160 of file qtoolbar.h.
|
readwrite |
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.
Definition at line 160 of file qtoolbar.h.
|
readwrite |
the style of toolbar buttons
This property defines the style of all tool buttons that are added as \l{QAction}s. Note that if you add a QToolButton with the addWidget() method, it will not get this button style.
To have the style of toolbuttons follow the system settings, set this property to Qt::ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms, Qt::ToolButtonFollowStyle means icon only.
The default is Qt::ToolButtonIconOnly.
Definition at line 160 of file qtoolbar.h.