Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.4.3
-
None
Description
t4id: 261413
Initial situation:
- Multiple sub windows in mdi area (ViewMode = SubWindowView)
- sub windows are not deleted when removing them from mdi area (no DeleteOnClose set and no explicit delete)
When removing a maximized sub window from the mdi area by calling QMdiArea::removeSubWindow the remaining sub windows are in window mode (instead of still being maximized).
The problem is located in qmdiarea.cpp:
void QMdiArea::removeSubWindow(QWidget *widget) { ... d->childWindows.removeAll(child); // -> Removes child from internal list .... child->setParent(0); // -> Generates a QEvent::ChildRemoved event for the viewport return; .... }
The problem is that the event handler for the ChildRemoved event relies on having the removed child still in the internal list. This is the case if you delete the child but not if you just remove it.
So the following code which is reponsible for the maximize handling is never executed:
bool QMdiArea::viewportEvent(QEvent *event) { .... case QEvent::ChildRemoved: { ... for (int i = 0; i < d->childWindows.size(); ++i) { QObject *child = d->childWindows.at(i); // -> List does not contain the removed child anymore! if (!child || child == removedChild || !child->parent() || child->parent() != viewport()) { ... d->showActiveWindowMaximized = true; } .... }