![](/static/61a827a1/assets/icons/icon-96x96.png)
![](https://programming.dev/pictrs/image/1d99f7cb-50e7-4994-94c4-fd23f30209b7.png)
Nice.
Depending upon what you are aiming for, I’d go with a sidebar. Something like this:
- (a) The sidebar’s horizontal width can be changed, causing all docked widgets in it to resize their width to fit.
- (b) The docked widgets/sections may resize vertically, either automatically or manually
- In case of manual resizing of widgets, you might want to add a scroll area in the widget
- (c) A widget/section may leave empty area in the bottom or vertically expand to fill
- (d) In case of empty area, the sidebar can either have empty space or be vertically shortened to expose part of the workspace underneath
- (e) Instead of having just a single widget, you can have a section on the toolbar, with multiple widgets in it. In this case, when the user changes the tab, the section will either automatically resize (vertically) as per widget requirements, or will stay the size that the user set manually, adding a scrollbar in case of overflow or empty area in case of lack of widget content.
This is in contrast to usual sidebars that tend to have a main tab bar, which only allows for a single docked widget to be shown at a time. This will allow the user to stack widgets both vertically and horizontally as per their requirements. A similar example can be seen in the right side panel in the Design Mode of Qt Creator itself.
Folded widgets/sections, when docked, will yield vertical space to other widgets/sections, which will in turn, snap upwards (or you can do downwards if that’s your fancy)
Maybe you can also make the floating widgets mergeable into tabs, which will reduce the number of point+click actions in cases where only 1 of 2 widgets is being used.
Oh! You actually used
QDockWidget
instead of making it from the start. I should have read the code before commenting, I guess.