QtBase  v6.3.1
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Friends | List of all members
QToolBar Class Reference

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

#include <qtoolbar.h>

Inheritance diagram for QToolBar:
Inheritance graph
[legend]
Collaboration diagram for QToolBar:
Collaboration graph
[legend]

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)
 

Public Member Functions

 QToolBar (const QString &title, QWidget *parent=nullptr)
 
 QToolBar (QWidget *parent=nullptr)
 
 ~QToolBar ()
 
void setMovable (bool movable)
 
bool isMovable () const
 
void setAllowedAreas (Qt::ToolBarAreas areas)
 
Qt::ToolBarAreas allowedAreas () const
 
bool isAreaAllowed (Qt::ToolBarArea area) const
 
void setOrientation (Qt::Orientation orientation)
 
Qt::Orientation orientation () const
 
void clear ()
 
QActionaddSeparator ()
 
QActioninsertSeparator (QAction *before)
 
QActionaddWidget (QWidget *widget)
 
QActioninsertWidget (QAction *before, QWidget *widget)
 
QRect actionGeometry (QAction *action) const
 
QActionactionAt (const QPoint &p) const
 
QActionactionAt (int x, int y) const
 
QActiontoggleViewAction () const
 
QSize iconSize () const
 
Qt::ToolButtonStyle toolButtonStyle () const
 
QWidgetwidgetForAction (QAction *action) const
 
bool isFloatable () const
 
void setFloatable (bool floatable)
 
bool isFloating () const
 
void addAction (QAction *action)
 
QActionaddAction (const QString &text)
 
QActionaddAction (const QIcon &icon, const QString &text)
 
QActionaddAction (const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection)
 
QActionaddAction (const QIcon &icon, const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename... Args, typename = compatible_action_slot_args<Args...>>
QActionaddAction (const QString &text, Args &&...args)
 
template<typename... Args, typename = compatible_action_slot_args<Args...>>
QActionaddAction (const QIcon &icon, const QString &text, Args &&...args)
 
- Public Member Functions inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags())
 
 ~QWidget ()
 
int devType () const override
 
WId winId () const
 
void createWinId ()
 
WId internalWinId () const
 
WId effectiveWinId () const
 
QStylestyle () const
 
void setStyle (QStyle *)
 
bool isWindow () const
 
bool isModal () const
 
Qt::WindowModality windowModality () const
 
void setWindowModality (Qt::WindowModality windowModality)
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *) const
 
QRect frameGeometry () const
 
const QRectgeometry () const
 
QRect normalGeometry () const
 
int x () const
 
int y () const
 
QPoint pos () const
 
QSize frameSize () const
 
QSize size () const
 
int width () const
 
int height () const
 
QRect rect () const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
QSize minimumSize () const
 
QSize maximumSize () const
 
int minimumWidth () const
 
int minimumHeight () const
 
int maximumWidth () const
 
int maximumHeight () const
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 
void setMinimumWidth (int minw)
 
void setMinimumHeight (int minh)
 
void setMaximumWidth (int maxw)
 
void setMaximumHeight (int maxh)
 
QSize sizeIncrement () const
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 
QSize baseSize () const
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 
void setFixedSize (const QSize &)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFixedHeight (int h)
 
QPointF mapToGlobal (const QPointF &) const
 
QPoint mapToGlobal (const QPoint &) const
 
QPointF mapFromGlobal (const QPointF &) const
 
QPoint mapFromGlobal (const QPoint &) const
 
QPointF mapToParent (const QPointF &) const
 
QPoint mapToParent (const QPoint &) const
 
QPointF mapFromParent (const QPointF &) const
 
QPoint mapFromParent (const QPoint &) const
 
QPointF mapTo (const QWidget *, const QPointF &) const
 
QPoint mapTo (const QWidget *, const QPoint &) const
 
QPointF mapFrom (const QWidget *, const QPointF &) const
 
QPoint mapFrom (const QWidget *, const QPoint &) const
 
QWidgetwindow () const
 
QWidgetnativeParentWidget () const
 
QWidgettopLevelWidget () const
 
const QPalettepalette () const
 
void setPalette (const QPalette &)
 
void setBackgroundRole (QPalette::ColorRole)
 
QPalette::ColorRole backgroundRole () const
 
void setForegroundRole (QPalette::ColorRole)
 
QPalette::ColorRole foregroundRole () const
 
const QFontfont () const
 
void setFont (const QFont &)
 
QFontMetrics fontMetrics () const
 
QFontInfo fontInfo () const
 
QCursor cursor () const
 
void setCursor (const QCursor &)
 
void unsetCursor ()
 
void setMouseTracking (bool enable)
 
bool hasMouseTracking () const
 
bool underMouse () const
 
void setTabletTracking (bool enable)
 
bool hasTabletTracking () const
 
void setMask (const QBitmap &)
 
void setMask (const QRegion &)
 
QRegion mask () const
 
void clearMask ()
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 
Q_INVOKABLE QPixmap grab (const QRect &rectangle=QRect(QPoint(0, 0), QSize(-1, -1)))
 
void grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
 
void ungrabGesture (Qt::GestureType type)
 
QString styleSheet () const
 
QString windowTitle () const
 
void setWindowIcon (const QIcon &icon)
 
QIcon windowIcon () const
 
void setWindowIconText (const QString &)
 
QString windowIconText () const
 
void setWindowRole (const QString &)
 
QString windowRole () const
 
void setWindowFilePath (const QString &filePath)
 
QString windowFilePath () const
 
void setWindowOpacity (qreal level)
 
qreal windowOpacity () const
 
bool isWindowModified () const
 
QString accessibleName () const
 
void setAccessibleName (const QString &name)
 
QString accessibleDescription () const
 
void setAccessibleDescription (const QString &description)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
Qt::LayoutDirection layoutDirection () const
 
void unsetLayoutDirection ()
 
void setLocale (const QLocale &locale)
 
QLocale locale () const
 
void unsetLocale ()
 
bool isRightToLeft () const
 
bool isLeftToRight () const
 
bool isActiveWindow () const
 
void activateWindow ()
 
void clearFocus ()
 
void setFocus (Qt::FocusReason reason)
 
Qt::FocusPolicy focusPolicy () const
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
bool hasFocus () const
 
void setFocusProxy (QWidget *)
 
QWidgetfocusProxy () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void grabMouse ()
 
void grabMouse (const QCursor &)
 
void releaseMouse ()
 
void grabKeyboard ()
 
void releaseKeyboard ()
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
void releaseShortcut (int id)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
bool updatesEnabled () const
 
void setUpdatesEnabled (bool enable)
 
void update (int x, int y, int w, int h)
 
void update (const QRect &)
 
void update (const QRegion &)
 
void repaint (int x, int y, int w, int h)
 
void repaint (const QRect &)
 
void repaint (const QRegion &)
 
void stackUnder (QWidget *)
 
void move (int x, int y)
 
void move (const QPoint &)
 
void resize (int w, int h)
 
void resize (const QSize &)
 
void setGeometry (int x, int y, int w, int h)
 
void setGeometry (const QRect &)
 
QByteArray saveGeometry () const
 
bool restoreGeometry (const QByteArray &geometry)
 
void adjustSize ()
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *) const
 
bool isHidden () const
 
bool isMinimized () const
 
bool isMaximized () const
 
bool isFullScreen () const
 
Qt::WindowStates windowState () const
 
void setWindowState (Qt::WindowStates state)
 
void overrideWindowState (Qt::WindowStates state)
 
virtual QSize sizeHint () const
 
virtual QSize minimumSizeHint () const
 
QSizePolicy sizePolicy () const
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
virtual int heightForWidth (int) const
 
virtual bool hasHeightForWidth () const
 
QRegion visibleRegion () const
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContentsMargins (const QMargins &margins)
 The setContentsMargins function sets the margins around the widget's contents. More...
 
QMargins contentsMargins () const
 The contentsMargins function returns the widget's contents margins. More...
 
QRect contentsRect () const
 
QLayoutlayout () const
 
void setLayout (QLayout *)
 
void updateGeometry ()
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &)
 
QWidgetfocusWidget () const
 
QWidgetnextInFocusChain () const
 
QWidgetpreviousInFocusChain () const
 The previousInFocusChain function returns the previous widget in this widget's focus chain. More...
 
bool acceptDrops () const
 
void setAcceptDrops (bool on)
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void insertActions (QAction *before, const QList< QAction * > &actions)
 
void insertAction (QAction *before, QAction *action)
 
void removeAction (QAction *action)
 
QList< QAction * > actions () const
 
QActionaddAction (const QString &text)
 
QActionaddAction (const QIcon &icon, const QString &text)
 
QActionaddAction (const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection)
 
QActionaddAction (const QIcon &icon, const QString &text, const QObject *receiver, const char *member, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename... Args, typename = compatible_action_slot_args<Args...>>
QActionaddAction (const QString &text, Args &&...args)
 
template<typename... Args, typename = compatible_action_slot_args<Args...>>
QActionaddAction (const QIcon &icon, const QString &text, Args &&...args)
 
QWidgetparentWidget () const
 
void setWindowFlags (Qt::WindowFlags type)
 
Qt::WindowFlags windowFlags () const
 
void setWindowFlag (Qt::WindowType, bool on=true)
 
void overrideWindowFlags (Qt::WindowFlags type)
 
Qt::WindowType windowType () const
 
QWidgetchildAt (int x, int y) const
 
QWidgetchildAt (const QPoint &p) const
 
void setAttribute (Qt::WidgetAttribute, bool on=true)
 
bool testAttribute (Qt::WidgetAttribute) const
 
QPaintEnginepaintEngine () const override
 
void ensurePolished () const
 
bool isAncestorOf (const QWidget *child) const
 
bool autoFillBackground () const
 
void setAutoFillBackground (bool enabled)
 
QBackingStorebackingStore () const
 
QWindowwindowHandle () const
 
QScreenscreen () const
 
void setScreen (QScreen *)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery) const
 
Qt::InputMethodHints inputMethodHints () const
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 
virtual ~QObject ()
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const noexcept
 
bool blockSignals (bool b) noexcept
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 
template<typename T >
T findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<typename T >
QList< TfindChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
const QObjectListchildren () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 
void dumpObjectInfo () const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 
- Public Member Functions inherited from QPaintDevice
virtual ~QPaintDevice ()
 
bool paintingActive () const
 
int width () const
 
int height () const
 
int widthMM () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
qreal devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int colorCount () const
 
int depth () const
 

Protected Member Functions

void actionEvent (QActionEvent *event) override
 
void changeEvent (QEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
bool event (QEvent *event) override
 
virtual void initStyleOption (QStyleOptionToolBar *option) const
 
- Protected Member Functions inherited from QWidget
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void enterEvent (QEnterEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
virtual void contextMenuEvent (QContextMenuEvent *event)
 
virtual void showEvent (QShowEvent *event)
 
virtual void hideEvent (QHideEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, qintptr *result)
 
int metric (PaintDeviceMetric) const override
 
void initPainter (QPainter *painter) const override
 
QPaintDeviceredirected (QPoint *offset) const override
 
QPaintersharedPainter () const override
 
virtual void inputMethodEvent (QInputMethodEvent *)
 
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual bool focusNextPrevChild (bool next)
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
 QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QPaintDevice
 QPaintDevice () noexcept
 

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
 

Additional Inherited Members

- Public Types inherited from QWidget
enum  RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 }
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM ,
  PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY ,
  PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled
}
 
- Static Public Member Functions inherited from QWidget
static void setTabOrder (QWidget *, QWidget *)
 
static QWidgetmouseGrabber ()
 
static QWidgetkeyboardGrabber ()
 
static QWidgetfind (WId)
 
static QWidgetcreateWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
static QMetaObject::Connection ::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot)
 
template<typename Func1 , typename Func2 >
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Static Public Member Functions inherited from QPaintDevice
static qreal devicePixelRatioFScale ()
 
- Protected Slots inherited from QWidget
void updateMicroFocus (Qt::InputMethodQuery query=Qt::ImQueryAll)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Attributes inherited from QPaintDevice
ushort painters
 

Detailed Description

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.

See also
QToolButton, QMenu, QAction, {Qt Widgets - Application Example}

Definition at line 58 of file qtoolbar.h.

Constructor & Destructor Documentation

◆ QToolBar() [1/2]

QToolBar::QToolBar ( const QString title,
QWidget parent = nullptr 
)
explicit

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()

Definition at line 520 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ QToolBar() [2/2]

QToolBar::QToolBar ( QWidget parent = nullptr)
explicit

Constructs a QToolBar with the given parent.

Definition at line 505 of file qtoolbar.cpp.

◆ ~QToolBar()

QToolBar::~QToolBar ( )

Destroys the toolbar.

Definition at line 530 of file qtoolbar.cpp.

Member Function Documentation

◆ actionAt() [1/2]

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

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

See also
QWidget::childAt()

Definition at line 831 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actionAt() [2/2]

QAction * QToolBar::actionAt ( int  x,
int  y 
) const
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.

Here is the call graph for this function:

◆ actionEvent()

void QToolBar::actionEvent ( QActionEvent event)
overrideprotectedvirtual

\reimp

Reimplemented from QWidget.

Definition at line 850 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ actionGeometry()

QRect QToolBar::actionGeometry ( QAction action) const

Definition at line 815 of file qtoolbar.cpp.

◆ actionTriggered

void QToolBar::actionTriggered ( QAction action)
signal

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.

◆ addAction() [1/7]

QAction * QWidget::addAction

Definition at line 598 of file qwidget.cpp.

◆ addAction() [2/7]

template<typename... Args, typename = compatible_action_slot_args<Args...>>
QAction* QWidget::addAction ( typename...  Args,
typename  = compatible_action_slot_args<Args...> 
)
inline

Definition at line 611 of file qwidget.h.

◆ addAction() [3/7]

QAction* QWidget::addAction

◆ addAction() [4/7]

QAction * QWidget::addAction

Definition at line 597 of file qwidget.cpp.

◆ addAction() [5/7]

template<typename... Args, typename = compatible_action_slot_args<Args...>>
QAction* QWidget::addAction ( typename...  Args,
typename  = compatible_action_slot_args<Args...> 
)
inline

Definition at line 604 of file qwidget.h.

◆ addAction() [6/7]

QAction* QWidget::addAction

◆ addAction() [7/7]

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.

See also
removeAction(), insertAction(), actions(), QMenu

Definition at line 589 of file qwidget.cpp.

Here is the caller graph for this function:

◆ addSeparator()

QAction * QToolBar::addSeparator ( )

Adds a separator to the end of the toolbar.

See also
insertSeparator()

Definition at line 744 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ addWidget()

QAction * QToolBar::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 toolbar'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()

Definition at line 781 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowedAreas()

Qt::ToolBarAreas QToolBar::allowedAreas ( ) const

Definition at line 615 of file qtoolbar.cpp.

◆ allowedAreasChanged

void QToolBar::allowedAreasChanged ( Qt::ToolBarAreas  allowedAreas)
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.

See also
allowedAreas
Here is the caller graph for this function:

◆ changeEvent()

void QToolBar::changeEvent ( QEvent event)
overrideprotectedvirtual

\reimp

Reimplemented from QWidget.

Definition at line 896 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ clear()

void QToolBar::clear ( )

Removes all actions from the toolbar.

See also
removeAction()

Definition at line 732 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ event()

bool QToolBar::event ( QEvent event)
overrideprotectedvirtual

\reimp

Reimplemented from QWidget.

Definition at line 994 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ iconSize()

QSize QToolBar::iconSize ( ) const

Definition at line 664 of file qtoolbar.cpp.

◆ iconSizeChanged

void QToolBar::iconSizeChanged ( const QSize iconSize)
signal

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

See also
iconSize, QMainWindow::iconSize
Here is the caller graph for this function:

◆ initStyleOption()

void QToolBar::initStyleOption ( QStyleOptionToolBar *  option) const
protectedvirtual

Definition at line 1116 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertSeparator()

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()

Definition at line 758 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ insertWidget()

QAction * QToolBar::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()

Definition at line 800 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ isAreaAllowed()

bool QToolBar::isAreaAllowed ( Qt::ToolBarArea  area) const
inline

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

Definition at line 84 of file qtoolbar.h.

◆ isFloatable()

bool QToolBar::isFloatable ( ) const

Definition at line 568 of file qtoolbar.cpp.

◆ isFloating()

bool QToolBar::isFloating ( ) const

Definition at line 588 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMovable()

bool QToolBar::isMovable ( ) const

Definition at line 556 of file qtoolbar.cpp.

Here is the caller graph for this function:

◆ movableChanged

void QToolBar::movableChanged ( bool  movable)
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.

See also
movable
Here is the caller graph for this function:

◆ orientation()

Qt::Orientation QToolBar::orientation ( ) const

Definition at line 651 of file qtoolbar.cpp.

◆ orientationChanged

void QToolBar::orientationChanged ( Qt::Orientation  orientation)
signal

This signal is emitted when the orientation of the toolbar changes. The orientation parameter holds the toolbar's new orientation.

See also
orientation
Here is the caller graph for this function:

◆ paintEvent()

void QToolBar::paintEvent ( QPaintEvent event)
overrideprotectedvirtual

\reimp

Reimplemented from QWidget.

Definition at line 919 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ setAllowedAreas()

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

Definition at line 605 of file qtoolbar.cpp.

◆ setFloatable()

void QToolBar::setFloatable ( bool  floatable)

Definition at line 574 of file qtoolbar.cpp.

◆ setIconSize

void QToolBar::setIconSize ( const QSize iconSize)
slot

Definition at line 667 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMovable()

void QToolBar::setMovable ( bool  movable)

Definition at line 546 of file qtoolbar.cpp.

◆ setOrientation()

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

Definition at line 632 of file qtoolbar.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setToolButtonStyle

void QToolBar::setToolButtonStyle ( Qt::ToolButtonStyle  toolButtonStyle)
slot

Definition at line 716 of file qtoolbar.cpp.

Here is the call graph for this function:

◆ toggleViewAction()

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, QWidget::windowTitle

Definition at line 1090 of file qtoolbar.cpp.

◆ toolButtonStyle()

Qt::ToolButtonStyle QToolBar::toolButtonStyle ( ) const

Definition at line 713 of file qtoolbar.cpp.

◆ toolButtonStyleChanged

void QToolBar::toolButtonStyleChanged ( Qt::ToolButtonStyle  toolButtonStyle)
signal

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, QMainWindow::toolButtonStyle
Here is the caller graph for this function:

◆ topLevelChanged

void QToolBar::topLevelChanged ( bool  topLevel)
signal
Since
4.6

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.

See also
isWindow()

◆ visibilityChanged

void QToolBar::visibilityChanged ( bool  visible)
signal
Since
4.7

This signal is emitted when the toolbar becomes visible (or invisible). This happens when the widget is hidden or shown.

◆ widgetForAction()

QWidget * QToolBar::widgetForAction ( QAction action) const
Since
4.2

Returns the widget associated with the specified action.

See also
addWidget()

Definition at line 1100 of file qtoolbar.cpp.

Friends And Related Function Documentation

◆ QMainWindowLayout

friend class QMainWindowLayout
friend

Definition at line 152 of file qtoolbar.h.

◆ QToolBarAreaLayout

friend class QToolBarAreaLayout
friend

Definition at line 154 of file qtoolbar.h.

◆ QToolBarLayout

friend class QToolBarLayout
friend

Definition at line 153 of file qtoolbar.h.

Property Documentation

◆ allowedAreas

QToolBar::allowedAreas
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.

See also
movable

Definition at line 160 of file qtoolbar.h.

◆ floatable

QToolBar::floatable
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.

◆ floating

QToolBar::floating
read

whether the toolbar is an independent window.

By default, this property is true.

See also
QWidget::isWindow()

Definition at line 160 of file qtoolbar.h.

◆ iconSize

QToolBar::iconSize
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.

◆ movable

QToolBar::movable
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.

See also
allowedAreas

Definition at line 160 of file qtoolbar.h.

◆ orientation

QToolBar::orientation
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.

◆ toolButtonStyle

QToolBar::toolButtonStyle
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.


The documentation for this class was generated from the following files: