The PySide.QtGui.QWorkspace widget provides a workspace window that can be used in an MDI application.
This class is deprecated. Use PySide.QtGui.QMdiArea instead.
Multiple Document Interface (MDI) applications are typically composed of a main window containing a menu bar, a toolbar, and a central PySide.QtGui.QWorkspace widget. The workspace itself is used to display a number of child windows, each of which is a widget.
The workspace itself is an ordinary Qt widget. It has a standard constructor that takes a parent widget. Workspaces can be placed in any layout, but are typically given as the central widget in a PySide.QtGui.QMainWindow :
class MainWindow(...): def __init__(self): self.workspace = QWorkspace() self.setCentralWidget(workspace) ...Child windows (MDI windows) are standard Qt widgets that are inserted into the workspace with PySide.QtGui.QWorkspace.addWindow() . As with top-level widgets, you can call functions such as PySide.QtGui.QWidget.show() , PySide.QtGui.QWidget.hide() , PySide.QtGui.QWidget.showMaximized() , and PySide.QtGui.QWidget.setWindowTitle() on a child window to change its appearance within the workspace. You can also provide widget flags to determine the layout of the decoration or the behavior of the widget itself.
To change or retrieve the geometry of a child window, you must operate on its PySide.QtGui.QWidget.parentWidget() . The PySide.QtGui.QWidget.parentWidget() provides access to the decorated frame that contains the child window widget. When a child window is maximised, its decorated frame is hidden. If the top-level widget contains a menu bar, it will display the maximised window’s operations menu to the left of the menu entries, and the window’s controls to the right.
A child window becomes active when it gets the keyboard focus, or when PySide.QtGui.QWidget.setFocus() is called. The user can activate a window by moving focus in the usual ways, for example by clicking a window or by pressing Tab. The workspace emits a signal PySide.QtGui.QWorkspace.windowActivated() when the active window changes, and the function PySide.QtGui.QWorkspace.activeWindow() returns a pointer to the active child window, or 0 if no window is active.
The convenience function PySide.QtGui.QWorkspace.windowList() returns a list of all child windows. This information could be used in a popup menu containing a list of windows, for example. This feature is also available as part of the Window Menu Solution.
PySide.QtGui.QWorkspace provides two built-in layout strategies for child windows: PySide.QtGui.QWorkspace.cascade() and PySide.QtGui.QWorkspace.tile() . Both are slots so you can easily connect menu entries to them.
If you want your users to be able to work with child windows larger than the visible workspace area, set the PySide.QtGui.QWorkspace.scrollBarsEnabled() property to true.
See also
PySide.QtGui.QDockWidget MDI Example
Parameters: | parent – PySide.QtGui.QWidget |
---|
Constructs a workspace with the given parent .
Specifies the order in which child windows are returned from PySide.QtGui.QWorkspace.windowList() .
Constant | Description |
---|---|
QWorkspace.CreationOrder | The windows are returned in the order of their creation |
QWorkspace.StackingOrder | The windows are returned in the order of their stacking |
Gives the input focus to the next window in the list of child windows.
Gives the input focus to the previous window in the list of child windows.
Return type: | PySide.QtGui.QWidget |
---|
Returns a pointer to the widget corresponding to the active child window, or 0 if no window is active.
Parameters: |
|
---|---|
Return type: |
Arranges all iconified windows at the bottom of the workspace.
Return type: | PySide.QtGui.QBrush |
---|
This property holds the workspace’s background.
Arranges all the child windows in a cascade pattern.
Closes the child window that is currently active.
Closes all child windows.
If any child window fails to accept the close event, the remaining windows will remain open.
Return type: | PySide.QtCore.bool |
---|
This property holds whether the workspace provides scroll bars.
If this property is true, the workspace will provide scroll bars if any of the child windows extend beyond the edges of the visible workspace. The workspace area will automatically increase to contain child windows if they are resized beyond the right or bottom edges of the visible area.
If this property is false (the default), resizing child windows out of the visible area of the workspace is not permitted, although it is still possible to position them partially outside the visible area.
Parameters: | w – PySide.QtGui.QWidget |
---|
Makes the child window that contains w the active child window.
Parameters: | background – PySide.QtGui.QBrush |
---|
This property holds the workspace’s background.
Parameters: | enable – PySide.QtCore.bool |
---|
This property holds whether the workspace provides scroll bars.
If this property is true, the workspace will provide scroll bars if any of the child windows extend beyond the edges of the visible workspace. The workspace area will automatically increase to contain child windows if they are resized beyond the right or bottom edges of the visible area.
If this property is false (the default), resizing child windows out of the visible area of the workspace is not permitted, although it is still possible to position them partially outside the visible area.
Arranges all child windows in a tile pattern.
Parameters: | w – PySide.QtGui.QWidget |
---|
Parameters: | order – PySide.QtGui.QWorkspace.WindowOrder |
---|---|
Return type: |
Returns a list of all visible or minimized child windows. If order is CreationOrder (the default), the windows are listed in the order in which they were inserted into the workspace. If order is StackingOrder , the windows are listed in their stacking order, with the topmost window as the last item in the list.