View Full Version : Suggestions for collapsible group boxes?

4th August 2007, 20:47

I am looking for implementation suggestions on how to implement something
similar to the attached image.
I need a way to collapse down the individual 'groupbox' displays contained
in this form. This implementation was originally done in VB and the small
<< control will collapse or expand the groupbox.

I originally approached this as dockable windows, but I cannot be tied to
the qmainwindow area. This set of groupboxes appear on a stacked widget

Any suggestions appreciated.
QT 4.3 on windows..


4th August 2007, 20:52
Hint: create a custom widget, especially if you want your collapsible group boxes to look like that.

It shouldn't be very complex:
You will have:
1. The group box widget with a vertical layout( QWidget )

2. Two widgets contained by the widget at 1).
2.1. The group box title bar(QWidget with a horizontal layout, containing a horizontal spacer and a custom button. the spacer is needed to push the collapse/expand button to the right )

2.2. The group box client area -- just a QWidget in which you can add other widgets
3. The widget from 2.1 should contain the expand/collapse button. When this button is pressed then the widget at 2.2 should be hidden/shown.
Hiding the widget will cause the vertical layout set to widget 1) to update its size, shrinking to the size of the title bar.
Showing the widget will have an opposed effect.