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

Incorrect tabbar when adding a QMdiSubWindow to a QMdiArea with TabbedView viewMode

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.4.0
    • GUI: Workspace
    • None

    Description

      When a QMdiArea's viewMode is QMdiArea::TabbedView and a QMdiSubWindow is added to the QMdiArea, a new tab is created for this new sub window.

      This is to be expected in most cases.

      However, a problem arises when the new sub window is not shown (show()).

      If the sub window is added to the QMdiArea but not shown, a tab is created for the sub window. This tab can be clicked, however, since the sub window is not shown, clicking the tab has no affect. Furthermore, once the tab is clicked, it then becomes disabled as opposed to being disabled to begin with.

      Perhaps the tab should not be visible if the sub window is not visible. It is perfectly reasonable to add a sub window but not show it immediately.

      Test case main.cpp to reproduce
      ===============================
      #include <QtGui>

      class MainWindow : public QMainWindow
      {
      Q_OBJECT
      public:
      MainWindow(QWidget *parent = 0)
      : QMainWindow(parent), tabCount(0)

      { mdiArea = new QMdiArea; mdiArea->setViewMode(QMdiArea::TabbedView); setCentralWidget(mdiArea); QMdiSubWindow *sub1 = mdiArea->addSubWindow(new QTextEdit); QMdiSubWindow *sub2 = mdiArea->addSubWindow(new QTextEdit); QMdiSubWindow *sub3 = mdiArea->addSubWindow(new QTextEdit); new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A), this, SLOT(addMdiAreaSubWindow())); }

      public slots:
      void addMdiAreaSubWindow()

      { QMdiSubWindow *sw = mdiArea->addSubWindow(new QTextEdit((QString("New QMdiSubWindow %1").arg(tabCount)))); sw->setWindowTitle(QString("New QMdiSubWindow %1").arg(tabCount++)); //sw->show(); }

      private:
      QMdiArea *mdiArea;
      int tabCount;
      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      MainWindow mw;
      mw.show();
      return a.exec();
      }

      Attachments

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

        Activity

          People

            bjnilsen Bjørn Erik Nilsen
            gpf Shane McLaughlin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes