QLayout: different SizeConstraints for width and height?


I'm having some problems with widgets that should adjust their size when child-widgets become invisible.

The widget contains a Grid Layout with several, vertically stacked items. Each item is either a widget or another (HBox-)Layout containing two widgets.
In certain situations, both widgets of such a nested HBoxLayout are set invisible. When this happens, I'd like to have the height of the whole widget reduced accordingly. With no extra code, the widget size stays the same, the remaining layout items are arranged with additional space between them.

I've read about size constraints, and indeed layout()->setSizeConstraint(QLayout::SetFixedSize) has some effect. The widget height is adjusted as desired. However, also the widget width is reduced, which is contrary to my layout needs. The widget should occupy available horizontal extra space, but still use the smallest height possible.

It seems that I need a better understanding about things like widget size hints and layout constraints. Is there any information more detailled than Qt's layout overview, besides the source code?

I already made some tests concerning this problem, and I found a point that seems to be confusing: Before and after I set the child widgets invisible, I check layout()->minimumSize().height(). Before the child becomes invisible, a minimum height of 130 is reported, which is the actual size of the widget. The funny thing is, after hiding the child widgets, a minimum height of 126 is reported, which does not meet my expectations. The hidden children's height clearly exceeds 4 pixels, and using QLayout::SetFixedSize, the widget shrinks to a height of 103.
(But layout()->minimumSize().height() still reports 126...)

Thanks in advance for any help!