Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6.3
-
None
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 = 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);