- class QMdiArea¶
The
QMdiArea
widget provides an area in which MDI windows are displayed. More…Synopsis¶
Properties¶
activationOrderᅟ
- The ordering criteria for subwindow listsbackgroundᅟ
- The background brush for the workspacedocumentModeᅟ
- Whether the tab bar is set to document mode in tabbed view modetabPositionᅟ
- The position of the tabs in tabbed view modetabShapeᅟ
- The shape of the tabs in tabbed view modetabsClosableᅟ
- Whether the tab bar should place close buttons on each tab in tabbed view modetabsMovableᅟ
- Whether the user can move the tabs within the tabbar area in tabbed view modeviewModeᅟ
- The way sub-windows are displayed in the QMdiArea
Methods¶
def
__init__()
def
addSubWindow()
def
background()
def
documentMode()
def
setBackground()
def
setOption()
def
setTabPosition()
def
setTabShape()
def
setTabsMovable()
def
setViewMode()
def
subWindowList()
def
tabPosition()
def
tabShape()
def
tabsClosable()
def
tabsMovable()
def
testOption()
def
viewMode()
Slots¶
Signals¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
QMdiArea
functions, essentially, like a window manager for MDI windows. For instance, it draws the windows it manages on itself and arranges them in a cascading or tile pattern.QMdiArea
is commonly used as the center widget in aQMainWindow
to create MDI applications, but can also be placed in any layout. The following code adds an area to a main window:mainWindow = QMainWindow() mainWindow.setCentralWidget(mdiArea)
Unlike the window managers for top-level windows, all window flags (Qt::WindowFlags) are supported by
QMdiArea
as long as the flags are supported by the current widget style. If a specific flag is not supported by the style (e.g., the WindowShadeButtonHint), you can still shade the window with showShaded().Subwindows in
QMdiArea
are instances ofQMdiSubWindow
. They are added to an MDI area withaddSubWindow()
. It is common to pass aQWidget
, which is set as the internal widget, to this function, but it is also possible to pass aQMdiSubWindow
directly. The class inheritsQWidget
, and you can use the same API as with a normal top-level window when programming.QMdiSubWindow
also has behavior that is specific to MDI windows. See theQMdiSubWindow
class description for more details.A subwindow becomes active when it gets the keyboard focus, or when
setFocus()
is called. The user activates a window by moving focus in the usual ways. The MDI area emits thesubWindowActivated()
signal when the active window changes, and theactiveSubWindow()
function returns the active subwindow.The convenience function
subWindowList()
returns a list of all subwindows. This information could be used in a popup menu containing a list of windows, for example.The subwindows are sorted by the current
WindowOrder
. This is used for thesubWindowList()
and foractivateNextSubWindow()
andactivatePreviousSubWindow()
. Also, it is used when cascading or tiling the windows withcascadeSubWindows()
andtileSubWindows()
.QMdiArea
provides two built-in layout strategies for subwindows:cascadeSubWindows()
andtileSubWindows()
. Both are slots and are easily connected to menu entries.- class AreaOption¶
(inherits
enum.Flag
) This enum describes options that customize the behavior of theQMdiArea
.Constant
Description
QMdiArea.DontMaximizeSubWindowOnActivation
When the active subwindow is maximized, the default behavior is to maximize the next subwindow that is activated. Set this option if you do not want this behavior.
- class WindowOrder¶
Specifies the criteria to use for ordering the list of child windows returned by
subWindowList()
. The functionscascadeSubWindows()
andtileSubWindows()
follow this order when arranging the windows.Constant
Description
QMdiArea.CreationOrder
The windows are returned in the order of their creation.
QMdiArea.StackingOrder
The windows are returned in the order in which they are stacked, with the top-most window being last in the list.
QMdiArea.ActivationHistoryOrder
The windows are returned in the order in which they were activated.
See also
- class ViewMode¶
This enum describes the view mode of the area; i.e. how sub-windows will be displayed.
Constant
Description
QMdiArea.SubWindowView
Display sub-windows with window frames (default).
QMdiArea.TabbedView
Display sub-windows with tabs in a tab bar.
See also
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property activationOrderᅟ: QMdiArea.WindowOrder¶
This property holds the ordering criteria for subwindow lists.
This property specifies the ordering criteria for the list of subwindows returned by
subWindowList()
. By default, it is the window creation order.See also
- Access functions:
This property holds the background brush for the workspace.
This property sets the background brush for the workspace area itself. By default, it is a gray color, but can be any brush (e.g., colors, gradients or pixmaps).
- Access functions:
- property documentModeᅟ: bool¶
This property holds whether the tab bar is set to document mode in tabbed view mode..
Document mode is disabled by default.
See also
- Access functions:
- property tabPositionᅟ: QTabWidget.TabPosition¶
This property holds the position of the tabs in tabbed view mode..
Possible values for this property are described by the
TabPosition
enum.See also
- Access functions:
- property tabShapeᅟ: QTabWidget.TabShape¶
This property holds the shape of the tabs in tabbed view mode..
Possible values for this property are
Rounded
(default) orTriangular
.See also
- Access functions:
- property tabsClosableᅟ: bool¶
This property holds whether the tab bar should place close buttons on each tab in tabbed view mode..
Tabs are not closable by default.
See also
- Access functions:
- property tabsMovableᅟ: bool¶
This property holds whether the user can move the tabs within the tabbar area in tabbed view mode..
Tabs are not movable by default.
See also
movable
setViewMode()
- Access functions:
- property viewModeᅟ: QMdiArea.ViewMode¶
This property holds the way sub-windows are displayed in the
QMdiArea
..By default, the
SubWindowView
is used to display sub-windows.See also
- Access functions:
Constructs an empty mdi area.
parent
is passed toQWidget
‘s constructor.- activateNextSubWindow()¶
Gives the keyboard focus to another window in the list of child windows. The window activated will be the next one determined by the current
activation order
.See also
- activatePreviousSubWindow()¶
Gives the keyboard focus to another window in the list of child windows. The window activated will be the previous one determined by the current
activation order
.See also
- activationOrder()¶
- Return type:
See also
Getter of property
activationOrderᅟ
.- activeSubWindow()¶
- Return type:
Returns a pointer to the current active subwindow. If no window is currently active,
None
is returned.Subwindows are treated as top-level windows with respect to window state, i.e., if a widget outside the MDI area is the active window, no subwindow will be active. Note that if a widget in the window in which the MDI area lives gains focus, the window will be activated.
See also
setActiveSubWindow()
WindowState
- addSubWindow(widget[, flags=Qt.WindowFlags()])¶
- Parameters:
widget –
QWidget
flags – Combination of
WindowType
- Return type:
Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
Adds
widget
as a new subwindow to the MDI area. IfwindowFlags
are non-zero, they will override the flags set on the widget.The
widget
can be either aQMdiSubWindow
or anotherQWidget
(in which case the MDI area will create a subwindow and set thewidget
as the internal widget).Note
Once the subwindow has been added, its parent will be the viewport widget of the
QMdiArea
.mdiArea = QMdiArea() subWindow1 = QMdiSubWindow() subWindow1.setWidget(internalWidget1) subWindow1.setAttribute(Qt.WA_DeleteOnClose) mdiArea.addSubWindow(subWindow1) subWindow2 = mdiArea.addSubWindow(internalWidget2)
When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be deleted when closed in the MDI area. If not, the window will be hidden and the MDI area will not activate the next subwindow.
Returns the
QMdiSubWindow
that is added to the MDI area.See also
- background()¶
- Return type:
See also
Getter of property
backgroundᅟ
.- cascadeSubWindows()¶
Arranges all the child windows in a cascade pattern.
See also
- closeActiveSubWindow()¶
Closes the active subwindow.
See also
- closeAllSubWindows()¶
Closes all subwindows by sending a QCloseEvent to each window. You may receive
subWindowActivated()
signals from subwindows before they are closed (if the MDI area activates the subwindow when another is closing).Subwindows that ignore the close event will remain open.
See also
- currentSubWindow()¶
- Return type:
Returns a pointer to the current subwindow, or
None
if there is no current subwindow.This function will return the same as
activeSubWindow()
if theQApplication
containingQMdiArea
is active.See also
- documentMode()¶
- Return type:
bool
See also
Getter of property
documentModeᅟ
.Removes
widget
from the MDI area. Thewidget
must be either aQMdiSubWindow
or a widget that is the internal widget of a subwindow. Notewidget
is never actually deleted byQMdiArea
. If aQMdiSubWindow
is passed in, its parent is set toNone
and it is removed; but if an internal widget is passed in, the child widget is set toNone
and theQMdiSubWindow
is not removed.See also
- setActivationOrder(order)¶
- Parameters:
order –
WindowOrder
See also
Setter of property
activationOrderᅟ
.- setActiveSubWindow(window)¶
- Parameters:
window –
QMdiSubWindow
Activates the subwindow
window
. Ifwindow
isNone
, any current active window is deactivated.See also
Setter of property
backgroundᅟ
.- setDocumentMode(enabled)¶
- Parameters:
enabled – bool
See also
Setter of property
documentModeᅟ
.- setOption(option[, on=true])¶
- Parameters:
option –
AreaOption
on – bool
If
on
is true,option
is enabled on the MDI area; otherwise it is disabled. SeeAreaOption
for the effect of each option.See also
- setTabPosition(position)¶
- Parameters:
position –
TabPosition
See also
Setter of property
tabPositionᅟ
.Setter of property
tabShapeᅟ
.- setTabsClosable(closable)¶
- Parameters:
closable – bool
See also
Setter of property
tabsClosableᅟ
.- setTabsMovable(movable)¶
- Parameters:
movable – bool
See also
Setter of property
tabsMovableᅟ
.Setter of property
viewModeᅟ
.- subWindowActivated(arg__1)¶
- Parameters:
arg__1 –
QMdiSubWindow
QMdiArea
emits this signal afterwindow
has been activated. Whenwindow
isNone
,QMdiArea
has just deactivated its last active window, and there are no active windows on the workspace.See also
- subWindowList([order=QMdiArea.WindowOrder.CreationOrder])¶
- Parameters:
order –
WindowOrder
- Return type:
.list of QMdiSubWindow
Returns a list of all subwindows in the MDI area. If
order
isCreationOrder
(the default), the windows are sorted in the order in which they were inserted into the workspace. Iforder
isStackingOrder
, the windows are listed in their stacking order, with the topmost window as the last item in the list. Iforder
isActivationHistoryOrder
, the windows are listed according to their recent activation history.See also
- tabPosition()¶
- Return type:
See also
Getter of property
tabPositionᅟ
.- tabShape()¶
- Return type:
See also
Getter of property
tabShapeᅟ
.- tabsClosable()¶
- Return type:
bool
See also
Getter of property
tabsClosableᅟ
.- tabsMovable()¶
- Return type:
bool
See also
Getter of property
tabsMovableᅟ
.- testOption(opton)¶
- Parameters:
opton –
AreaOption
- Return type:
bool
Returns
true
ifoption
is enabled; otherwise returnsfalse
.See also
- tileSubWindows()¶
Arranges all child windows in a tile pattern.
See also
- viewMode()¶
- Return type:
See also
Getter of property
viewModeᅟ
.