Search code examples
qtwidgetalignmentqt-creator

How to arrange items horizontally in vertical layout?


I have a QWidget with following items aranged in a vertical layout:

- QWidget
  - QVBoxLayout
    - QPushButton
    - QPushButton
    - QPushButton
    - QListView
    - QComboBox

now, I would like to arrange the QComboBox in a horizontal alignment to one of the buttons. I gave the booton a maximumSize of 36 x 16777215 and it sits at the top left of the widget. How Do I get the combo box to align on the right side of it? Here's a screen shot of what I currently have:

QWidget


Solution

  • Embed your combobox into an horizontallayout and add spacer https://doc.qt.io/archives/2.3/designer/chap4_2.html