PythonQt.QtGui.QMainWindow · declarations 001
Back to PythonQt.QtGui.QMainWindow
AllowNestedDocks
instance-attribute
AllowNestedDocks: Any
AllowTabbedDocks
instance-attribute
AllowTabbedDocks: Any
AnimatedDocks
instance-attribute
AnimatedDocks: Any
DockOption
instance-attribute
DockOption: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
DockOptions
instance-attribute
DockOptions: type
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
ForceTabbedDocks
instance-attribute
ForceTabbedDocks: Any
GroupedDragging
instance-attribute
GroupedDragging: Any
VerticalTabs
instance-attribute
VerticalTabs: Any
addDockWidget
addDockWidget(area: Any, dockwidget: Any, orientation: Any) -> None
X.addDockWidget(area, dockwidget, orientation)
Supplemental documentation: Qt 5 reference:
void QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
Adds the given dockwidget to the specified area.
void QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget, Qt::Orientation orientation)
Adds dockwidget into the given area in the direction specified by the orientation.
Upstream PySide2 reference signatures (binding differences may apply):
addDockWidget(self, area: PySide2.QtCore.Qt.DockWidgetArea, dockwidget: PySide2.QtWidgets.QDockWidget) -> None
addDockWidget(self, area: PySide2.QtCore.Qt.DockWidgetArea, dockwidget: PySide2.QtWidgets.QDockWidget, orientation: PySide2.QtCore.Qt.Orientation) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#addDockWidget
addToolBar
addToolBar(area: Any, toolbar: Any) -> Any
X.addToolBar(area, toolbar)
Supplemental documentation: Qt 5 reference:
void QMainWindow::addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
Adds the toolbar into the specified area in this main window. The toolbar is placed at the end of the current tool bar block (i.e. line). If the main window already manages toolbar then it will only move the toolbar to area.
See also insertToolBar(), addToolBarBreak(), and insertToolBarBreak().
void QMainWindow::addToolBar(QToolBar *toolbar)
This is an overloaded function.
Equivalent of calling addToolBar(Qt::TopToolBarArea, toolbar)
QToolBar *QMainWindow::addToolBar(const QString \&title)
This is an overloaded function.
Creates a QToolBar object, setting its window title to title, and inserts it into the top toolbar area.
See also setWindowTitle().
Upstream PySide2 reference signatures (binding differences may apply):
addToolBar(self, area: PySide2.QtCore.Qt.ToolBarArea, toolbar: PySide2.QtWidgets.QToolBar) -> None
addToolBar(self, title: str) -> PySide2.QtWidgets.QToolBar
addToolBar(self, toolbar: PySide2.QtWidgets.QToolBar) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#addToolBar
addToolBarBreak
addToolBarBreak(area: Any) -> None
X.addToolBarBreak(area)
Supplemental documentation: Qt 5 reference:
void QMainWindow::addToolBarBreak(Qt::ToolBarArea area \= Qt::TopToolBarArea)
Adds a toolbar break to the given area after all the other objects that are present.
Upstream PySide2 reference signatures (binding differences may apply):
addToolBarBreak(self, area: PySide2.QtCore.Qt.ToolBarArea=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#addToolBarBreak
animated
instance-attribute
animated: Any
Qt 5 reference:
animated : 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 QMainWindow to 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 AnimatedDocks option using setDockOptions().
This property was introduced in Qt 4.2.
Access functions:
| bool | isAnimated() const |
|---|---|
| void | setAnimated(bool enabled) |
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#animated
centralWidget
centralWidget() -> Any
X.centralWidget() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QMainWindow::centralWidget() const
Returns the central widget for the main window. This function returns zero if the central widget has not been set.
See also setCentralWidget().
Upstream PySide2 reference signatures (binding differences may apply):
centralWidget(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#centralWidget
contextMenuEvent
contextMenuEvent(event: Any) -> None
X.contextMenuEvent(event)
Supplemental documentation: Qt 5 reference:
[override virtual protected] void QMainWindow::contextMenuEvent(QContextMenuEvent *event)
Reimplements: QWidget::contextMenuEvent(QContextMenuEvent *event).
Upstream PySide2 reference signatures (binding differences may apply):
contextMenuEvent(self, event: PySide2.QtGui.QContextMenuEvent) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#contextMenuEvent
corner
corner(corner: Any) -> Any
X.corner(corner)
Supplemental documentation: Qt 5 reference:
Qt::DockWidgetArea QMainWindow::corner(Qt::Corner corner) const
Returns the dock widget area that occupies the specified corner.
See also setCorner().
Upstream PySide2 reference signatures (binding differences may apply):
corner(self, corner: PySide2.QtCore.Qt.Corner) -> PySide2.QtCore.Qt.DockWidgetArea
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#corner
createPopupMenu
createPopupMenu() -> Any
X.createPopupMenu() -> PythonQt.QtGui.QMenu
Supplemental documentation: Qt 5 reference:
[virtual] QMenu *QMainWindow::createPopupMenu()
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 nullptr.
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 addDockWidget(), addToolBar(), and menuBar().
Upstream PySide2 reference signatures (binding differences may apply):
createPopupMenu(self) -> PySide2.QtWidgets.QMenu
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#createPopupMenu
customContextMenuRequested
customContextMenuRequested(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QMainWindow.customContextMenuRequested; argument details are not documented.
destroyed
destroyed(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QMainWindow.destroyed; argument details are not documented.
dockNestingEnabled
instance-attribute
dockNestingEnabled: Any
Qt 5 reference:
dockNestingEnabled : 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 AllowNestedDocks option using setDockOptions().
This property was introduced in Qt 4.2.
Access functions:
| bool | isDockNestingEnabled() const |
|---|---|
| void | setDockNestingEnabled(bool enabled) |
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#dockNestingEnabled
dockOptions
instance-attribute
dockOptions: Any
Qt 5 reference:
dockOptions : DockOptions
This property holds the docking behavior of QMainWindow
The default value is AnimatedDocks | AllowTabbedDocks.
This property was introduced in Qt 4.3.
Access functions:
| QMainWindow::DockOptions | dockOptions() const |
|---|---|
| void | setDockOptions(QMainWindow::DockOptions options) |
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#dockOptions
dockWidgetArea
dockWidgetArea(dockwidget: Any) -> Any
X.dockWidgetArea(dockwidget)
Supplemental documentation: Qt 5 reference:
Qt::DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) const
Returns the
Qt::DockWidgetArea for
dockwidget. If dockwidget has not been added to the main window, this function
returns Qt::NoDockWidgetArea.
See also addDockWidget(), splitDockWidget(), and Qt::DockWidgetArea.
Upstream PySide2 reference signatures (binding differences may apply):
dockWidgetArea(self, dockwidget: PySide2.QtWidgets.QDockWidget) -> PySide2.QtCore.Qt.DockWidgetArea
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#dockWidgetArea
documentMode
instance-attribute
documentMode: bool
Qt 5 reference:
documentMode : bool
This property holds whether the tab bar for tabbed dockwidgets is set to document mode.
The default is false.
This property was introduced in Qt 4.5.
Access functions:
| bool | documentMode() const |
|---|---|
| void | setDocumentMode(bool enabled) |
See also QTabBar::documentMode.
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#documentMode
event
event(event: Any) -> bool
X.event(event) -> bool
Supplemental documentation: Qt 5 reference:
[override virtual protected] bool QMainWindow::event(QEvent *event)
Reimplements: QWidget::event(QEvent *event).
Upstream PySide2 reference signatures (binding differences may apply):
event(self, event: PySide2.QtCore.QEvent) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#event
iconSize
instance-attribute
iconSize: QSize
Qt 5 reference:
iconSize : QSize
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.
Access functions:
| QSize | iconSize() const |
|---|---|
| void | setIconSize(const QSize \&iconSize) |
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#iconSize
iconSizeChanged
iconSizeChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QMainWindow.iconSizeChanged; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QMainWindow::iconSizeChanged(const QSize \&iconSize)
This signal is emitted when the size of the icons used in the window is changed. The new icon size is passed in iconSize.
You can connect this signal to other components to help maintain a consistent appearance for your application.
See also setIconSize().
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#iconSizeChanged
insertToolBar
insertToolBar(before: Any, toolbar: Any) -> None
X.insertToolBar(before, toolbar)
Supplemental documentation: Qt 5 reference:
void QMainWindow::insertToolBar(QToolBar *before, QToolBar *toolbar)
Inserts the toolbar into the area occupied by the before toolbar so that it appears before it. For example, in normal left-to-right layout operation, this means that toolbar will appear to the left of the toolbar specified by before in a horizontal toolbar area.
See also insertToolBarBreak(), addToolBar(), and addToolBarBreak().
Upstream PySide2 reference signatures (binding differences may apply):
insertToolBar(self, before: PySide2.QtWidgets.QToolBar, toolbar: PySide2.QtWidgets.QToolBar) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#insertToolBar
insertToolBarBreak
insertToolBarBreak(before: Any) -> None
X.insertToolBarBreak(before)
Supplemental documentation: Qt 5 reference:
void QMainWindow::insertToolBarBreak(QToolBar *before)
Inserts a toolbar break before the toolbar specified by before.
Upstream PySide2 reference signatures (binding differences may apply):
insertToolBarBreak(self, before: PySide2.QtWidgets.QToolBar) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#insertToolBarBreak
isAnimated
isAnimated() -> bool
X.isAnimated() -> bool
Upstream PySide2 reference signatures (binding differences may apply):
isAnimated(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#isAnimated
isDockNestingEnabled
isDockNestingEnabled() -> bool
X.isDockNestingEnabled() -> bool
Upstream PySide2 reference signatures (binding differences may apply):
isDockNestingEnabled(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#isDockNestingEnabled
isSeparator
isSeparator(pos: Any) -> bool
X.isSeparator(pos) -> bool
Upstream PySide2 reference signatures (binding differences may apply):
isSeparator(self, pos: PySide2.QtCore.QPoint) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#isSeparator
menuBar
menuBar() -> Any
X.menuBar() -> PythonQt.QtGui.QMenuBar
Supplemental documentation: Qt 5 reference:
QMenuBar *QMainWindow::menuBar() const
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 QMainWindow as 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:
QMenuBar *menuBar = new QMenuBar(nullptr);
See also setMenuBar().
Upstream PySide2 reference signatures (binding differences may apply):
menuBar(self) -> PySide2.QtWidgets.QMenuBar
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#menuBar
menuWidget
menuWidget() -> Any
X.menuWidget() -> PythonQt.QtGui.QWidget
Supplemental documentation: Qt 5 reference:
QWidget *QMainWindow::menuWidget() const
Returns the menu bar for the main window. This function returns null if a menu bar hasn't been constructed yet.
This function was introduced in Qt 4.2.
See also setMenuWidget().
Upstream PySide2 reference signatures (binding differences may apply):
menuWidget(self) -> PySide2.QtWidgets.QWidget
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#menuWidget
objectNameChanged
objectNameChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QMainWindow.objectNameChanged; argument details are not documented.
removeDockWidget
removeDockWidget(dockwidget: Any) -> None
X.removeDockWidget(dockwidget)
Supplemental documentation: Qt 5 reference:
void QMainWindow::removeDockWidget(QDockWidget *dockwidget)
Removes the dockwidget from the main window layout and hides it. Note that the dockwidget is not deleted.
Upstream PySide2 reference signatures (binding differences may apply):
removeDockWidget(self, dockwidget: PySide2.QtWidgets.QDockWidget) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#removeDockWidget
removeToolBar
removeToolBar(toolbar: Any) -> None
X.removeToolBar(toolbar)
Supplemental documentation: Qt 5 reference:
void QMainWindow::removeToolBar(QToolBar *toolbar)
Removes the toolbar from the main window layout and hides it. Note that the toolbar is not deleted.
Upstream PySide2 reference signatures (binding differences may apply):
removeToolBar(self, toolbar: PySide2.QtWidgets.QToolBar) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#removeToolBar
removeToolBarBreak
removeToolBarBreak(before: Any) -> None
X.removeToolBarBreak(before)
Supplemental documentation: Qt 5 reference:
void QMainWindow::removeToolBarBreak(QToolBar *before)
Removes a toolbar break previously inserted before the toolbar specified by before.
Upstream PySide2 reference signatures (binding differences may apply):
removeToolBarBreak(self, before: PySide2.QtWidgets.QToolBar) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#removeToolBarBreak
resizeDocks
resizeDocks(docks: Any, sizes: Any, orientation: Any) -> None
X.resizeDocks(docks, sizes, orientation)
Supplemental documentation: Qt 5 reference:
void QMainWindow::resizeDocks(const QList\<QDockWidget *> \&docks, const QList\<int> \&sizes, Qt::Orientation orientation)
Resizes the dock widgets in the list docks to the corresponding size in pixels from the list sizes. If orientation is Qt::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 QMainWindow itself 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.
This function was introduced in Qt 5.6.
Upstream PySide2 reference signatures (binding differences may apply):
resizeDocks(self, docks: typing.Sequence[PySide2.QtWidgets.QDockWidget], sizes: shibokensupport.typing27.Sequence, orientation: PySide2.QtCore.Qt.Orientation) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#resizeDocks
restoreDockWidget
restoreDockWidget(dockwidget: Any) -> bool
X.restoreDockWidget(dockwidget) -> bool
Supplemental documentation: Qt 5 reference:
bool QMainWindow::restoreDockWidget(QDockWidget *dockwidget)
Restores the state of dockwidget if it is created after the call to
restoreState().
Returns true if the state was restored; otherwise returns false.
See also restoreState() and saveState().
Upstream PySide2 reference signatures (binding differences may apply):
restoreDockWidget(self, dockwidget: PySide2.QtWidgets.QDockWidget) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#restoreDockWidget
restoreState
restoreState(state: Any, version: int) -> bool
X.restoreState(state, version) -> bool
Supplemental documentation: Qt 5 reference:
bool QMainWindow::restoreState(const QByteArray \&state, int version \= 0)
Restores the state of this mainwindow's toolbars and dockwidgets. Also restores the
corner settings too. The version number 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:
void MainWindow::readSettings()
{
QSettings settings("MyCompany", "MyApp");
restoreGeometry(settings.value("myWidget/geometry").toByteArray());
restoreState(settings.value("myWidget/windowState").toByteArray());
}
See also saveState(), QWidget::saveGeometry(), QWidget::restoreGeometry(), and restoreDockWidget().
Upstream PySide2 reference signatures (binding differences may apply):
restoreState(self, state: PySide2.QtCore.QByteArray, version: int=...) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#restoreState
saveState
saveState(version: int) -> Any
X.saveState(version) -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
QByteArray QMainWindow::saveState(int version \= 0) const
Saves the current state of this mainwindow's toolbars and dockwidgets. This includes the corner settings which can be set with setCorner(). The version number is stored as part of the data.
The objectName property is used to identify each QToolBar and QDockWidget. You should make sure that this property is unique for each QToolBar and QDockWidget you add to the QMainWindow
To restore the saved state, pass the return value and version number to restoreState().
To save the geometry when the window closes, you can implement a close event like this:
void MyMainWindow::closeEvent(QCloseEvent *event)
{
QSettings settings("MyCompany", "MyApp");
settings.setValue("geometry", saveGeometry());
settings.setValue("windowState", saveState());
QMainWindow::closeEvent(event);
}
See also restoreState(), QWidget::saveGeometry(), and QWidget::restoreGeometry().
Upstream PySide2 reference signatures (binding differences may apply):
saveState(self, version: int=...) -> PySide2.QtCore.QByteArray
Source: https://doc.qt.io/archives/qt-5.15/qmainwindow.html#saveState