We have already discussed the differences between SDI and MDI applications in Chapter 3, Main Windows and Layout Management. We saw many implementations of SDI applications. In this section, we will explore a technique of creating MDI applications.
A Multiple Document Interface application will consist of a main window where multiple child windows and dialogs reside and appear for interaction. The central widget can be either the PySide.QtGui.QMdiArea
or PySide.QtGui.QWorkSpace
widget. They are by themselves widget components that manage the central area of the main window to arrange the MDI windows in a layout. Subwindows are then created and added to the MDI area or a workspace. An example of the MDI application is given as follows:
class MyMDIApp(QMainWindow): def __init__(self): QMainWindow.__init__(self) workspace = QWorkspace() workspace.setWindowTitle("Simple WorkSpace Example") for i in range(5): textEdit...