Yesterday, I calmed down and looked at qmdiarea carefully.
As the central component of mainwindow, qmdiarea is still very effective.
First, add qsubwindow to qmdiarea and delete qsubwindow from qmdiarea.
Qsubwindow * addsubwindow (qwidget * widget );
The widget can be a qsubwindow or a qwidget and a subclass directly. If the widget is the latter, qmdiarea automatically creates a qsubwindow and sets the widget as the setwidget () of qsubwindow ();
First, removesubwindow does not delete the widget, and then click the close button of subwindow. MDI does not call removesubwindow, but only hides the widget. To re-display the subwindow, only subwindow-> shownormal () is used (), form-> show ();
To hide the function, you can call the hide () function of subwindow.
Orthodox shutdown and display are paired calls of addsubwindow and removesubwindow.
You can set the wa_deleteonclose attribute of the subwindow and its widgets. When it is closed, the subwindow and its widgets will be deleted, and the created form and subwindow will be copied and displayed. This is necessary in some cases, at least memory savings