Hi,
I'm trying to create a sort of indented list of checkboxes in the Designer. Here's how the result should look like:
Form.png
I'm using Horizontal Spacers to create actual indents, setting their sizeType to Fixed and sizeHint to whatever size I like. Then I group each spacer with its checkbox and enclose them in a QHBoxLayout. Then I apply a vertical layout to the whole widget. In the Designer it looks like this:
FormInDesigner.png
Now, when I resize the widget, the checkboxes are no longer spaced evenly in vertical direction:
FormInDesignerResized.png
My question: how can I control the vertical sizing behavior of nested QHBoxLayouts? There appears to be no such thing as a sizePolicy for the QHBoxLayout... I've tried several options of layoutSizeConstraint, but they don't seem to have any effect.
Thanks!


Reply With Quote


, the only reason AFAIK for this to happens is that QVBoxLayout arrange items by their height and QHBoxLayout don't return correct height for the items inside it (from brief look at the src it actually return sizeHint so probably I'm wrong on this one). So it treats QHBoxLayout as expendable horizontally and thus the bigger size for this layout. But as I said, it's only untested theory, please correct my if I'm wrong, or simply see implementation of the Q[H/V]BoxLayout.

Bookmarks