Layout alignment option doesn't actually align widget in QHBoxLayout
-
I have 2 widgets inside of the mentioned layout, both with top vertical, and left horizontal alignment. Now the problem is that both of them get aligned to the top vertically, but the second object doesn't get aligned horizontally whatever I set for that option.
I am using Qt 6 with C++ and forms.
-
Hi,
Please provide a minimal compilable example that shows the behaviour your describe.
-
While it's nice to see the result you have, not knowing how to reproduce it makes it difficult to reproduce and understand.
-
That's why a minimal compilable example is useful: people work together on the same issue in the same conditions.
-
https://drive.google.com/file/d/1LPRK2Xyax7FpnLzU_JxGczKNrYjNSIxS/view?usp=sharing
Here, a minimal compilable example. As you can see Button2 won't move strictly to the left, next to Button1.
-
Hi
Super with both code and picture.However, its working as expected.
The box layout is a bit special how it operates.
When you put in 2 buttons. the area allocated to the layout is split into 2 parts of the same size.
When you then ask a button to align left, it aligns left in the half area where it belongs.So it does align to the left as you can see on your picture.
The right button is aligned to the left of its right part of the total area.You can press them to the left by using a Spacer
-