stdcerr
stdcerr

Reputation: 15668

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

Upvotes: 3

Views: 3022

Answers (2)

nmud
nmud

Reputation: 175

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.

Upvotes: 0

Bastien Thonnat
Bastien Thonnat

Reputation: 561

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

Upvotes: 6

Related Questions