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

QMdiArea TabbedView doesn't work properly

    XMLWordPrintable

Details

    Description

      Steps to reproduce / test case:

      Set the setCentralWidget with a QMdiArea not in the constructor: it works only when the view mode is not TabbedView. When it's TabbedView, the activeSubWindow method always returns 0, the currentSubWindows works only at times and even the subWindowActivated signal doesn't work.

      The bug can be reproduced with the mdi demo of Qt with a few changes:

      • setCentralWidget(mdiArea);

      + mdiArea->setViewMode(QMdiArea::TabbedView);
      + setCentralWidget(new QWidget());

      void MainWindow::newFile()
      {
      + if (centralWidget() != mdiArea)
      + setCentralWidget(mdiArea);
      MdiChild *child = createMdiChild();
      child->newFile();
      child->show();
      }

      void MainWindow::open()
      {
      QString fileName = QFileDialog::getOpenFileName(this);
      if (!fileName.isEmpty()) {
      QMdiSubWindow *existing = findMdiChild(fileName);
      if (existing) {
      mdiArea->setActiveSubWindow(existing);
      return;
      }

      + if (centralWidget() != mdiArea)
      + setCentralWidget(mdiArea);

      MdiChild *child = createMdiChild();
      if (child->loadFile(fileName)) {
      statusBar()->showMessage(tr("File loaded"), 2000);
      child->show();
      } else {
      child->close();
      }
      }
      }

      As you can see, the open and newFile methods are provided with a statement which sets the central widget to mdiArea if not already set.

      I hereby attach the sources to reproduce the bug, which in my opinion is quite an important one.

      When executing the samples, just open a file or press new and you will see that the menus are not refreshed and you can't save etc, since the signal i mentioned is not emitted and activeSubWindow always returns 0.

      More information:

      It has to be noted that when the view mode is not TabbedView, then the bug can not be reproduced.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes