Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align items to left in a horizontal layout in Qt

Tags:

qt

I have a horizontal layout that contains QLabels. These QLabels are actually icons and I want to left align them in the horizontal layout. The problem is that they are centered no matter what I do. I try to select them all with horizontal left alignment, but they are still centered. I am trying this in Qt Creator under the design page.

Is this expected behavior? Any suggestions on how to get this work?

like image 605
uniquenamehere Avatar asked Feb 15 '14 22:02

uniquenamehere


People also ask

How do I add horizontal layout to vertical layout in Qt?

You can add a QWidget (or a QFrame) at the top of your vertical layout, then you give this widget (or frame) an horizontal layout and you put your button and your combox box inside this widget with the horizontal layout.


1 Answers

You should add a horizontal spacer to the layout. Horizontal spacer is available in the left column of Designer, under "Spacers" section.

like image 64
Pavel Strakhov Avatar answered Sep 21 '22 00:09

Pavel Strakhov