Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5446

Maximized state of sub windows is not kept when removing one from the mdi area

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.4.3
    • GUI: Window management
    • 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;
      }
      ....
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes