View Full Version : How to collapse rows of a QFormLayout?

12th December 2009, 18:00
Hello all,

I would like to have a the GUI of a dialog box organised as with a QFormLayout, except that I should be able to programmatically collapse/uncollapse specific rows. By collapsing, I mean hiding and resizing to zero height such as to have the next row occupy the space of the collapsed ones. Is there a way to achieve this, with QFormLayout or otherwise?


12th December 2009, 21:43
just hide/show all the widgets in the row.

Its better to use horizontal layout, i guess.

Organize all your rows in separate horizontal layout and based on your condition you can hide or unhide(show) all the widgets you have for that row.
Don't forget to stack up every thing in vertical layout.

To have easy way of life in debugging and coding, if you have more than one widget in row embed them into a single widget. This way hiding and show can be done in a simpler way.

Try with designer to have fell at least, if you don't want to use it.

I don't know about form layout may be you can do the same thing with that also.

14th December 2009, 08:39
That indeed works, thanks! I had tried something along those lines before but did not get it quite right. Now it's fine.