Hi all,

so i'm not actually new to Qt, yet I still cannot understand how QLayout, Alignment and Sizepolicy work in combination. Building a complex Layout always results in rage and trial&error.

Its pretty clear that e.g. i will create a QWidget and a QHBoxLayout. To the Layout i will add two PushButtons.
At this point, the button widgets share the layouts width 50:50

1.jpg

Changing the buttons Sizepolicy has no effect (probably because the layout[or the button widget itself?] will hintsize here to share the whole size of the layout's widget between the button widgets?).
As soon as I set any Alignment, the button will have a decreased width. I have no idea where that new size is coming from. I thought it might be based on the buttons text but it isnt. SizePolicy still has no effect.

2.jpg

I truly dont understand or find any documentation on this behavior.
I can only guess that Qts default hintSize is calculating different for whatever condition.

Can somebody provide a link to a documentation or explain, how those 3 layout objects work together?