QDockWidget doesn't resize after add widget
-
wrote on 29 Jun 2017, 08:15 last edited by
Hi everyone,
I'm using a QDockWidget in MainWindow. When I insert a widget (in my case a table) into the dock, it does not expand with the widget, but it expands to a fixed size and then the scrollbar appears.
However, if the widget is smaller than this initial fixed size, the Dock fits.
But I didn't set any minimum or maximum size.
Here is the dock code:QDockWidget *pPropertyDock = new QDockWidget(this); pPropertyDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); pPropertyDock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea); pPropertyDock->setWindowTitle(DOCK_TITLE); pPropertyDock->setObjectName(DOCK_OBJECTNAME); addDockWidget(Qt::RightDockWidgetArea, pPropertyDock);
According to what the documentation says, the Dock should be adapted to the child widget.
I do not understand where this maximal initial width comes from.
Anyway I can extend it by hand, but I would like to extend in automatic.I hope I explained myself
Thank you
-
Hi everyone,
I'm using a QDockWidget in MainWindow. When I insert a widget (in my case a table) into the dock, it does not expand with the widget, but it expands to a fixed size and then the scrollbar appears.
However, if the widget is smaller than this initial fixed size, the Dock fits.
But I didn't set any minimum or maximum size.
Here is the dock code:QDockWidget *pPropertyDock = new QDockWidget(this); pPropertyDock->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); pPropertyDock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea); pPropertyDock->setWindowTitle(DOCK_TITLE); pPropertyDock->setObjectName(DOCK_OBJECTNAME); addDockWidget(Qt::RightDockWidgetArea, pPropertyDock);
According to what the documentation says, the Dock should be adapted to the child widget.
I do not understand where this maximal initial width comes from.
Anyway I can extend it by hand, but I would like to extend in automatic.I hope I explained myself
Thank you
@Gianluca86 Is your dock widget in a layout?
-
wrote on 29 Jun 2017, 09:12 last edited by
I hope not to misunderstand the question, but anyway no, I created the Dock inside the Mainwindow (addDockWidget (Qt :: RightDockWidgetArea, pPropertyDock)), while in the mainWindow centralWidget there is another widget.
To insert the table into the Dock I simply used the command "setWidget" of QDockWidget. -
wrote on 29 Jun 2017, 12:35 last edited by
For more information:
the "Dock Widgets Example" show the problem. -
For more information:
the "Dock Widgets Example" show the problem.So the issue is that the dock is smaller than the QListWidget?
The dock seems to have the size from the area allocated when created.
Since there it no way it can adjust the splitter or the mainwindow size, how would it grow to fit the widget? -
wrote on 30 Jun 2017, 06:40 last edited by
So there is no way to adjust the area where the dock is allocated?
Can you do it only by hand? -
So there is no way to adjust the area where the dock is allocated?
Can you do it only by hand?@Gianluca86
You can make main window bigger and move the splitter. then
it should be bigger.
7/7