2
votes

I am trying the following experiment:

I have two QpushButtons, say PushA and PushB. Now PushA is in a QHBoxLayout and PushB is also in its own QHBoxLayout. Both these horizontal layouts are in another QHBoxLayout layout; lets call it HorizontalParentLayout. Here is where the problem starts. HorizontalParentLayout has a layout stretch factor of 1,4 and PushA has a maximum width of 100. When the HorizontalParentLayout is stretched the horizontal layout hosting PushA also grows whereas PushA grows to a certain size (maximum size) then stops. If I continue expanding HorizontalParentLayout the layout hosting PushA continues growing. This is shown in the diagram below. The purple arrows show that the layout is growing whereas the widget Pushbutton is fixed. I do not want this to happen. How can I make a layout section stop expanding once the widgets its hosting stops expanding two. This is what the image looks like

enter image description here

any suggestions would be appreciated.

1

1 Answers

0
votes

The layout on the left grows because you have set it to do that. That's what layoutStretch does.

Try setting the stretch factor on the HorizontalParentLayout to 0, 4 (i.e. so that the first column has no stretch).