I used the @thuga suggestion to set the alignment, but additionally I had to set a fixed size for the widget (I used to have only the minimum size settings), and I also needed to use the horizontal layout instead of the vertical one. For some reason, the vertical layout ignores the horizontal alignment of the scroll area.
I used setFixedSize()to set a fixed size for my custom widget, but layout and alignment can be set from Qt Designer.
source
share