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

QDockWidget's height is reduced

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.6.3
    • Widgets: Main Window
    • None
    • Windows

    Description

      1.QMainWindow has 3 QDockWidgets(A、B、C),QDockWidget's DockWidgetArea is Qt::LeftDockWidgetArea

      2.The orientations of A and B are Qt::Vertical, the orientations of C and AB are Qt::Horizontal

      3.QMainWindow has a QAction,the QAction calls

         A->setFixedWidth(A->width());

         B->setVisible(true or false);

         A->setMinimumSize(0, 0);

         A->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);

       

      Actual result:  each time B DockWidget, it hides and displays a cycle, and the height of B decreases by 2 pixels.

       
      Expected result: the height of B will not change.

       

      Code:

      // ui is a QMainWindow, the QMainWindow has a QMenuBar

      ui.setupUi(this);
      QAction* pAction = ui.mainToolBar->addAction("hide dock2");
      connect(pAction, &QAction::triggered, [&]()

      { m_pDock1->setFixedWidth(m_pDock1->width()); m_pDock2->setVisible(!m_pDock2->isVisible()); m_pDock1->setMinimumSize(0, 0); m_pDock1->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); }

      );

      m_pDock1 = new QDockWidget("1", this);
      m_pDock1->setWidget(new QLabel("hello"));
      m_pDock2 = new QDockWidget("2", this);
      m_pDock2->setWidget(new QLabel("world"));
      m_pDock3 = new QDockWidget("3", this);
      m_pDock3->setWidget(new QLabel("test"));
      addDockWidget(Qt::LeftDockWidgetArea, m_pDock1, Qt::Horizontal);
      addDockWidget(Qt::LeftDockWidgetArea, m_pDock2, Qt::Vertical);
      addDockWidget(Qt::LeftDockWidgetArea, m_pDock3, Qt::Horizontal);

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            noodle 巍 郭
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes