QMainWindow¶
The
QMainWindowclass provides a main application window. More…

Synopsis¶
Functions¶
- def - addDockWidget(area, dockwidget)
- def - addDockWidget(area, dockwidget, orientation)
- def - addToolBar(area, toolbar)
- def - addToolBar(title)
- def - addToolBar(toolbar)
- def - addToolBarBreak([area=Qt.TopToolBarArea])
- def - centralWidget()
- def - corner(corner)
- def - dockOptions()
- def - dockWidgetArea(dockwidget)
- def - documentMode()
- def - iconSize()
- def - insertToolBar(before, toolbar)
- def - insertToolBarBreak(before)
- def - isAnimated()
- def - isDockNestingEnabled()
- def - isSeparator(pos)
- def - menuBar()
- def - menuWidget()
- def - removeDockWidget(dockwidget)
- def - removeToolBar(toolbar)
- def - removeToolBarBreak(before)
- def - resizeDocks(docks, sizes, orientation)
- def - restoreDockWidget(dockwidget)
- def - restoreState(state[, version=0])
- def - saveState([version=0])
- def - setCentralWidget(widget)
- def - setCorner(corner, area)
- def - setDockOptions(options)
- def - setDocumentMode(enabled)
- def - setIconSize(iconSize)
- def - setMenuBar(menubar)
- def - setMenuWidget(menubar)
- def - setStatusBar(statusbar)
- def - setTabPosition(areas, tabPosition)
- def - setTabShape(tabShape)
- def - setToolButtonStyle(toolButtonStyle)
- def - splitDockWidget(after, dockwidget, orientation)
- def - statusBar()
- def - tabPosition(area)
- def - tabShape()
- def - tabifiedDockWidgets(dockwidget)
- def - tabifyDockWidget(first, second)
- def - takeCentralWidget()
- def - toolBarArea(toolbar)
- def - toolBarBreak(toolbar)
- def - toolButtonStyle()
- def - unifiedTitleAndToolBarOnMac()
Virtual functions¶
- def - createPopupMenu()
Slots¶
- def - setAnimated(enabled)
- def - setDockNestingEnabled(enabled)
- def - setUnifiedTitleAndToolBarOnMac(set)
Signals¶
- def - iconSizeChanged(iconSize)
- def - tabifiedDockWidgetActivated(dockWidget)
- def - toolButtonStyleChanged(toolButtonStyle)
Detailed Description¶
Qt Main Window Framework¶
A main window provides a framework for building an application’s user interface. Qt has
QMainWindowand its related classes for main window management.QMainWindowhas its own layout to which you can addQToolBars,QDockWidgets, aQMenuBar, and aQStatusBar. The layout has a center area that can be occupied by any kind of widget. You can see an image of the layout below.
Note
Creating a main window without a central widget is not supported. You must have a central widget even if it is just a placeholder.
Creating Main Window Components¶
A central widget will typically be a standard Qt widget such as a
QTextEditor aQGraphicsView. Custom widgets can also be used for advanced applications. You set the central widget withsetCentralWidget().Main windows have either a single (SDI) or multiple (MDI) document interface. You create MDI applications in Qt by using a
QMdiAreaas the central widget.We will now examine each of the other widgets that can be added to a main window. We give examples on how to create and add them.
Creating Toolbars¶
Toolbars are implemented in the
QToolBarclass. You add a toolbar to a main window withaddToolBar().You control the initial position of toolbars by assigning them to a specific
ToolBarArea. You can split an area by inserting a toolbar break - think of this as a line break in text editing - withaddToolBarBreak()orinsertToolBarBreak(). You can also restrict placement by the user withsetAllowedAreas()andsetMovable().The size of toolbar icons can be retrieved with
iconSize(). The sizes are platform dependent; you can set a fixed size withsetIconSize(). You can alter the appearance of all tool buttons in the toolbars withsetToolButtonStyle().An example of toolbar creation follows:
void MainWindow::createToolBars() { fileToolBar = addToolBar(tr("File")); fileToolBar->addAction(newAct);
Creating Dock Widgets¶
Dock widgets are implemented in the
QDockWidgetclass. A dock widget is a window that can be docked into the main window. You add dock widgets to a main window withaddDockWidget().There are four dock widget areas as given by the
DockWidgetAreaenum: left, right, top, and bottom. You can specify which dock widget area that should occupy the corners where the areas overlap withsetCorner(). By default each area can only contain one row (vertical or horizontal) of dock widgets, but if you enable nesting withsetDockNestingEnabled(), dock widgets can be added in either direction.Two dock widgets may also be stacked on top of each other. A
QTabBaris then used to select which of the widgets should be displayed.We give an example of how to create and add dock widgets to a main window:
dockWidget = QDockWidget(tr("Dock Widget"), self) dockWidget.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) dockWidget.setWidget(dockWidgetContents) addDockWidget(Qt.LeftDockWidgetArea, dockWidget)
The Status Bar¶
You can set a status bar with
setStatusBar(), but one is created the first timestatusBar()(which returns the main window’s status bar) is called. SeeQStatusBarfor information on how to use it.
Storing State¶
QMainWindowcan store the state of its layout withsaveState(); it can later be retrieved withrestoreState(). It is the position and size (relative to the size of the main window) of the toolbars and dock widgets that are stored.See also
QMenuBarQToolBarQStatusBarQDockWidgetApplication Example Dock Widgets Example MDI Example SDI Example Menus Example
- class PySide2.QtWidgets.QMainWindow([parent=None[, flags=Qt.WindowFlags()]])¶
- param parent:
- param flags:
- WindowFlags
 - Constructs a - QMainWindowwith the given- parentand the specified widget- flags.- QMainWindowsets the- Windowflag itself, and will hence always be created as a top-level widget.
- PySide2.QtWidgets.QMainWindow.DockOption¶
- This enum contains flags that specify the docking behavior of - QMainWindow.- Constant - Description - QMainWindow.AnimatedDocks - Identical to the - animatedproperty.- QMainWindow.AllowNestedDocks - Identical to the - dockNestingEnabledproperty.- QMainWindow.AllowTabbedDocks - The user can drop one dock widget “on top” of another. The two widgets are stacked and a tab bar appears for selecting which one is visible. - QMainWindow.ForceTabbedDocks - Each dock area contains a single stack of tabbed dock widgets. In other words, dock widgets cannot be placed next to each other in a dock area. If this option is set, has no effect. - QMainWindow.VerticalTabs - The two vertical dock areas on the sides of the main window show their tabs vertically. If this option is not set, all dock areas show their tabs at the bottom. Implies . See also - setTabPosition().- QMainWindow.GroupedDragging - When dragging the titlebar of a dock, all the tabs that are tabbed with it are going to be dragged. Implies . Does not work well if some QDockWidgets have restrictions in which area they are allowed. (This enum value was added in Qt 5.6.) - These options only control how dock widgets may be dropped in a - QMainWindow. They do not re-arrange the dock widgets to conform with the specified options. For this reason they should be set before any dock widgets are added to the main window. Exceptions to this are the and options, which may be set at any time.
- PySide2.QtWidgets.QMainWindow.addDockWidget(area, dockwidget)¶
- Parameters:
- area – - DockWidgetArea
- dockwidget – - PySide2.QtWidgets.QDockWidget
 
 - Adds the given - dockwidgetto the specified- area.
- PySide2.QtWidgets.QMainWindow.addDockWidget(area, dockwidget, orientation)
- Parameters:
- area – - DockWidgetArea
- dockwidget – - PySide2.QtWidgets.QDockWidget
- orientation – - Orientation
 
 - Adds - dockwidgetinto the given- areain the direction specified by the- orientation.
- PySide2.QtWidgets.QMainWindow.addToolBar(toolbar)¶
- Parameters:
- toolbar – - PySide2.QtWidgets.QToolBar
 - This is an overloaded function. - Equivalent of calling - addToolBar(- TopToolBarArea,- toolbar)
- PySide2.QtWidgets.QMainWindow.addToolBar(area, toolbar)
- Parameters:
- area – - ToolBarArea
- toolbar – - PySide2.QtWidgets.QToolBar
 
 - Adds the - toolbarinto the specified- areain this main window. The- toolbaris placed at the end of the current tool bar block (i.e. line). If the main window already manages- toolbarthen it will only move the toolbar to- area.
- PySide2.QtWidgets.QMainWindow.addToolBar(title)
- Parameters:
- title – str 
- Return type:
 
- PySide2.QtWidgets.QMainWindow.addToolBarBreak([area=Qt.TopToolBarArea])¶
- Parameters:
- area – - ToolBarArea
 - Adds a toolbar break to the given - areaafter all the other objects that are present.
- PySide2.QtWidgets.QMainWindow.centralWidget()¶
- Return type:
 - Returns the central widget for the main window. This function returns zero if the central widget has not been set. - See also 
- PySide2.QtWidgets.QMainWindow.corner(corner)¶
- Parameters:
- corner – - Corner
- Return type:
 - Returns the dock widget area that occupies the specified - corner.- See also 
- PySide2.QtWidgets.QMainWindow.createPopupMenu()¶
- Return type:
 - Returns a popup menu containing checkable entries for the toolbars and dock widgets present in the main window. If there are no toolbars and dock widgets present, this function returns - None.- By default, this function is called by the main window when the user activates a context menu, typically by right-clicking on a toolbar or a dock widget. - If you want to create a custom popup menu, reimplement this function and return a newly-created popup menu. Ownership of the popup menu is transferred to the caller. - See also 
- PySide2.QtWidgets.QMainWindow.dockOptions()¶
- Return type:
- DockOptions
 - This property holds the docking behavior of - QMainWindow.- The default value is - AnimatedDocks|- AllowTabbedDocks.
- PySide2.QtWidgets.QMainWindow.dockWidgetArea(dockwidget)¶
- Parameters:
- dockwidget – - PySide2.QtWidgets.QDockWidget
- Return type:
 - Returns the - DockWidgetAreafor- dockwidget. If- dockwidgethas not been added to the main window, this function returns- Qt::NoDockWidgetArea.- See also - addDockWidget()- splitDockWidget()- DockWidgetArea
- PySide2.QtWidgets.QMainWindow.documentMode()¶
- Return type:
- bool 
 - This property holds whether the tab bar for tabbed dockwidgets is set to document mode.. - The default is false. - See also 
- PySide2.QtWidgets.QMainWindow.iconSize()¶
- Return type:
 - This property holds size of toolbar icons in this mainwindow.. - The default is the default tool bar icon size of the GUI style. Note that the icons used must be at least of this size as the icons are only scaled down. 
- PySide2.QtWidgets.QMainWindow.iconSizeChanged(iconSize)¶
- Parameters:
- iconSize – - PySide2.QtCore.QSize
 
- PySide2.QtWidgets.QMainWindow.insertToolBar(before, toolbar)¶
- Parameters:
- before – - PySide2.QtWidgets.QToolBar
- toolbar – - PySide2.QtWidgets.QToolBar
 
 - Inserts the - toolbarinto the area occupied by the- beforetoolbar so that it appears before it. For example, in normal left-to-right layout operation, this means that- toolbarwill appear to the left of the toolbar specified by- beforein a horizontal toolbar area.
- PySide2.QtWidgets.QMainWindow.insertToolBarBreak(before)¶
- Parameters:
- before – - PySide2.QtWidgets.QToolBar
 - Inserts a toolbar break before the toolbar specified by - before.
- PySide2.QtWidgets.QMainWindow.isAnimated()¶
- Return type:
- bool 
 - This property holds whether manipulating dock widgets and tool bars is animated. - When a dock widget or tool bar is dragged over the main window, the main window adjusts its contents to indicate where the dock widget or tool bar will be docked if it is dropped. Setting this property causes - QMainWindowto move its contents in a smooth animation. Clearing this property causes the contents to snap into their new positions.- By default, this property is set. It may be cleared if the main window contains widgets which are slow at resizing or repainting themselves. - Setting this property is identical to setting the - AnimatedDocksoption using- setDockOptions().
- PySide2.QtWidgets.QMainWindow.isDockNestingEnabled()¶
- Return type:
- bool 
 - This property holds whether docks can be nested. - If this property is - false, dock areas can only contain a single row (horizontal or vertical) of dock widgets. If this property is- true, the area occupied by a dock widget can be split in either direction to contain more dock widgets.- Dock nesting is only necessary in applications that contain a lot of dock widgets. It gives the user greater freedom in organizing their main window. However, dock nesting leads to more complex (and less intuitive) behavior when a dock widget is dragged over the main window, since there are more ways in which a dropped dock widget may be placed in the dock area. - Setting this property is identical to setting the - AllowNestedDocksoption using- setDockOptions().
- PySide2.QtWidgets.QMainWindow.isSeparator(pos)¶
- Parameters:
- pos – - PySide2.QtCore.QPoint
- Return type:
- bool 
 
- Return type:
 - Returns the menu bar for the main window. This function creates and returns an empty menu bar if the menu bar does not exist. - If you want all windows in a Mac application to share one menu bar, don’t use this function to create it, because the menu bar created here will have this - QMainWindowas its parent. Instead, you must create a menu bar that does not have a parent, which you can then share among all the Mac windows. Create a parent-less menu bar this way:- menuBar = QMenuBar() - See also 
- Return type:
 - Returns the menu bar for the main window. This function returns null if a menu bar hasn’t been constructed yet. - See also 
- PySide2.QtWidgets.QMainWindow.removeDockWidget(dockwidget)¶
- Parameters:
- dockwidget – - PySide2.QtWidgets.QDockWidget
 - Removes the - dockwidgetfrom the main window layout and hides it. Note that the- dockwidgetis not deleted.
- PySide2.QtWidgets.QMainWindow.removeToolBar(toolbar)¶
- Parameters:
- toolbar – - PySide2.QtWidgets.QToolBar
 - Removes the - toolbarfrom the main window layout and hides it. Note that the- toolbaris not deleted.
- PySide2.QtWidgets.QMainWindow.removeToolBarBreak(before)¶
- Parameters:
- before – - PySide2.QtWidgets.QToolBar
 - Removes a toolbar break previously inserted before the toolbar specified by - before.
- PySide2.QtWidgets.QMainWindow.resizeDocks(docks, sizes, orientation)¶
- Parameters:
- docks – 
- sizes – 
- orientation – - Orientation
 
 - Resizes the dock widgets in the list - docksto the corresponding size in pixels from the list- sizes. If- orientationis- Horizontal, adjusts the width, otherwise adjusts the height of the dock widgets. The sizes will be adjusted such that the maximum and the minimum sizes are respected and the- QMainWindowitself will not be resized. Any additional/missing space is distributed amongst the widgets according to the relative weight of the sizes.- Example: - resizeDocks({blueWidget, yellowWidget}, {20 , 40}, Qt::Horizontal); - If the blue and the yellow widget are nested on the same level they will be resized such that the yellowWidget is twice as big as the blueWidget - If some widgets are grouped in tabs, only one widget per group should be specified. Widgets not in the list might be changed to respect the constraints. 
- PySide2.QtWidgets.QMainWindow.restoreDockWidget(dockwidget)¶
- Parameters:
- dockwidget – - PySide2.QtWidgets.QDockWidget
- Return type:
- bool 
 - Restores the state of - dockwidgetif it is created after the call to- restoreState(). Returns- trueif the state was restored; otherwise returns- false.- See also 
- PySide2.QtWidgets.QMainWindow.restoreState(state[, version=0])¶
- Parameters:
- state – - PySide2.QtCore.QByteArray
- version – int 
 
- Return type:
- bool 
 - Restores the - stateof this mainwindow’s toolbars and dockwidgets. Also restores the corner settings too. The- versionnumber is compared with that stored in- state. If they do not match, the mainwindow’s state is left unchanged, and this function returns- false; otherwise, the state is restored, and this function returns- true.- To restore geometry saved using - QSettings, you can use code like this:- def readSettings(self): settings = QSettings("MyCompany", "MyApp") restoreGeometry(settings.value("myWidget/geometry")) restoreState(settings.value("myWidget/windowState")) 
- PySide2.QtWidgets.QMainWindow.saveState([version=0])¶
- Parameters:
- version – int 
- Return type:
 - Saves the current state of this mainwindow’s toolbars and dockwidgets. This includes the corner settings which can be set with - setCorner(). The- versionnumber is stored as part of the data.- The - objectNameproperty is used to identify each- QToolBarand- QDockWidget. You should make sure that this property is unique for each- QToolBarand- QDockWidgetyou add to the- QMainWindow- To restore the saved state, pass the return value and - versionnumber to- restoreState().- To save the geometry when the window closes, you can implement a close event like this: - def closeEvent(self, event): settings = QSettings("MyCompany", "MyApp") settings.setValue("geometry", self.saveGeometry()) settings.setValue("windowState", self.saveState()) QMainWindow.closeEvent(self, event) 
- PySide2.QtWidgets.QMainWindow.setAnimated(enabled)¶
- Parameters:
- enabled – bool 
 - This property holds whether manipulating dock widgets and tool bars is animated. - When a dock widget or tool bar is dragged over the main window, the main window adjusts its contents to indicate where the dock widget or tool bar will be docked if it is dropped. Setting this property causes - QMainWindowto move its contents in a smooth animation. Clearing this property causes the contents to snap into their new positions.- By default, this property is set. It may be cleared if the main window contains widgets which are slow at resizing or repainting themselves. - Setting this property is identical to setting the - AnimatedDocksoption using- setDockOptions().
- PySide2.QtWidgets.QMainWindow.setCentralWidget(widget)¶
- Parameters:
- widget – - PySide2.QtWidgets.QWidget
 - Sets the given - widgetto be the main window’s central widget.- Note: - QMainWindowtakes ownership of the- widgetpointer and deletes it at the appropriate time.- See also 
- PySide2.QtWidgets.QMainWindow.setCorner(corner, area)¶
- Parameters:
- corner – - Corner
- area – - DockWidgetArea
 
 - Sets the given dock widget - areato occupy the specified- corner.- See also 
- PySide2.QtWidgets.QMainWindow.setDockNestingEnabled(enabled)¶
- Parameters:
- enabled – bool 
 - This property holds whether docks can be nested. - If this property is - false, dock areas can only contain a single row (horizontal or vertical) of dock widgets. If this property is- true, the area occupied by a dock widget can be split in either direction to contain more dock widgets.- Dock nesting is only necessary in applications that contain a lot of dock widgets. It gives the user greater freedom in organizing their main window. However, dock nesting leads to more complex (and less intuitive) behavior when a dock widget is dragged over the main window, since there are more ways in which a dropped dock widget may be placed in the dock area. - Setting this property is identical to setting the - AllowNestedDocksoption using- setDockOptions().
- PySide2.QtWidgets.QMainWindow.setDockOptions(options)¶
- Parameters:
- options – - DockOptions
 - This property holds the docking behavior of - QMainWindow.- The default value is - AnimatedDocks|- AllowTabbedDocks.
- PySide2.QtWidgets.QMainWindow.setDocumentMode(enabled)¶
- Parameters:
- enabled – bool 
 - This property holds whether the tab bar for tabbed dockwidgets is set to document mode.. - The default is false. - See also 
- PySide2.QtWidgets.QMainWindow.setIconSize(iconSize)¶
- Parameters:
- iconSize – - PySide2.QtCore.QSize
 - This property holds size of toolbar icons in this mainwindow.. - The default is the default tool bar icon size of the GUI style. Note that the icons used must be at least of this size as the icons are only scaled down. 
- PySide2.QtWidgets.QMainWindow.setMenuBar(menubar)¶
- Parameters:
- menubar – - PySide2.QtWidgets.QMenuBar
 - Sets the menu bar for the main window to - menuBar.- Note: - QMainWindowtakes ownership of the- menuBarpointer and deletes it at the appropriate time.- See also 
- PySide2.QtWidgets.QMainWindow.setMenuWidget(menubar)¶
- Parameters:
- menubar – - PySide2.QtWidgets.QWidget
 - Sets the menu bar for the main window to - menuBar.- QMainWindowtakes ownership of the- menuBarpointer and deletes it at the appropriate time.- See also 
- PySide2.QtWidgets.QMainWindow.setStatusBar(statusbar)¶
- Parameters:
- statusbar – - PySide2.QtWidgets.QStatusBar
 - Sets the status bar for the main window to - statusbar.- Setting the status bar to - Nonewill remove it from the main window. Note that- QMainWindowtakes ownership of the- statusbarpointer and deletes it at the appropriate time.- See also 
- PySide2.QtWidgets.QMainWindow.setTabPosition(areas, tabPosition)¶
- Parameters:
- areas – - DockWidgetAreas
- tabPosition – - TabPosition
 
 - Sets the tab position for the given dock widget - areasto the specified- tabPosition. By default, all dock areas show their tabs at the bottom.- Note - The - VerticalTabsdock option overrides the tab positions set by this method.- See also 
- PySide2.QtWidgets.QMainWindow.setTabShape(tabShape)¶
- Parameters:
- tabShape – - TabShape
 - This property holds the tab shape used for tabbed dock widgets.. - The default is - Rounded.- See also 
- PySide2.QtWidgets.QMainWindow.setToolButtonStyle(toolButtonStyle)¶
- Parameters:
- toolButtonStyle – - ToolButtonStyle
 - This property holds style of toolbar buttons in this mainwindow.. - To have the style of toolbuttons follow the system settings, set this property to - ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms,- ToolButtonFollowStylemeans icon only.- The default is - ToolButtonIconOnly.
- PySide2.QtWidgets.QMainWindow.setUnifiedTitleAndToolBarOnMac(set)¶
- Parameters:
- set – bool 
 - This property holds whether the window uses the unified title and toolbar look on macOS. - Note that the Qt 5 implementation has several limitations compared to Qt 4: - Use in windows with OpenGL content is not supported. This includes - QGLWidgetand- QOpenGLWidget.
- Using dockable or movable toolbars may result in painting errors and is not recommended 
 
- PySide2.QtWidgets.QMainWindow.splitDockWidget(after, dockwidget, orientation)¶
- Parameters:
- after – - PySide2.QtWidgets.QDockWidget
- dockwidget – - PySide2.QtWidgets.QDockWidget
- orientation – - Orientation
 
 - Splits the space covered by the - firstdock widget into two parts, moves the- firstdock widget into the first part, and moves the- seconddock widget into the second part.- The - orientationspecifies how the space is divided: A- Horizontalsplit places the second dock widget to the right of the first; a- Verticalsplit places the second dock widget below the first.- Note : if - firstis currently in a tabbed docked area,- secondwill be added as a new tab, not as a neighbor of- first. This is because a single tab can contain only one dock widget.- Note : The - LayoutDirectioninfluences the order of the dock widgets in the two parts of the divided area. When right-to-left layout direction is enabled, the placing of the dock widgets will be reversed.
- PySide2.QtWidgets.QMainWindow.statusBar()¶
- Return type:
 - Returns the status bar for the main window. This function creates and returns an empty status bar if the status bar does not exist. - See also 
- PySide2.QtWidgets.QMainWindow.tabPosition(area)¶
- Parameters:
- area – - DockWidgetArea
- Return type:
 - Returns the tab position for - area.- Note - The - VerticalTabsdock option overrides the tab positions returned by this function.- See also 
- PySide2.QtWidgets.QMainWindow.tabShape()¶
- Return type:
 - This property holds the tab shape used for tabbed dock widgets.. - The default is - Rounded.- See also 
- PySide2.QtWidgets.QMainWindow.tabifiedDockWidgetActivated(dockWidget)¶
- Parameters:
- dockWidget – - PySide2.QtWidgets.QDockWidget
 
- PySide2.QtWidgets.QMainWindow.tabifiedDockWidgets(dockwidget)¶
- Parameters:
- dockwidget – - PySide2.QtWidgets.QDockWidget
- Return type:
 - Returns the dock widgets that are tabified together with - dockwidget.- See also 
- PySide2.QtWidgets.QMainWindow.tabifyDockWidget(first, second)¶
- Parameters:
- first – - PySide2.QtWidgets.QDockWidget
- second – - PySide2.QtWidgets.QDockWidget
 
 - Moves - seconddock widget on top of- firstdock widget, creating a tabbed docked area in the main window.- See also 
- PySide2.QtWidgets.QMainWindow.takeCentralWidget()¶
- Return type:
 - Removes the central widget from this main window. - The ownership of the removed widget is passed to the caller. 
- PySide2.QtWidgets.QMainWindow.toolBarArea(toolbar)¶
- Parameters:
- toolbar – - PySide2.QtWidgets.QToolBar
- Return type:
 - Returns the - ToolBarAreafor- toolbar. If- toolbarhas not been added to the main window, this function returns- Qt::NoToolBarArea.- See also - addToolBar()- addToolBarBreak()- ToolBarArea
- PySide2.QtWidgets.QMainWindow.toolBarBreak(toolbar)¶
- Parameters:
- toolbar – - PySide2.QtWidgets.QToolBar
- Return type:
- bool 
 - Returns whether there is a toolbar break before the - toolbar.- See also 
- PySide2.QtWidgets.QMainWindow.toolButtonStyle()¶
- Return type:
 - This property holds style of toolbar buttons in this mainwindow.. - To have the style of toolbuttons follow the system settings, set this property to - ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms,- ToolButtonFollowStylemeans icon only.- The default is - ToolButtonIconOnly.
- PySide2.QtWidgets.QMainWindow.toolButtonStyleChanged(toolButtonStyle)¶
- Parameters:
- toolButtonStyle – - ToolButtonStyle
 
- PySide2.QtWidgets.QMainWindow.unifiedTitleAndToolBarOnMac()¶
- Return type:
- bool 
 - This property holds whether the window uses the unified title and toolbar look on macOS. - Note that the Qt 5 implementation has several limitations compared to Qt 4: - Use in windows with OpenGL content is not supported. This includes - QGLWidgetand- QOpenGLWidget.
- Using dockable or movable toolbars may result in painting errors and is not recommended 
 
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
