Reputation: 2772
I am using a vertical layout that contains a Qlistview on top and a button at the bottom. I am trying to add the button at the bottom right but it is positioned at the bottom left. I've tried self.verticalLayout.setAlignment(QtCore.Qt.AlignRight)
but I think that'd only work if the vlayout was part of a bigger layout.
Upvotes: 8
Views: 24865
Reputation: 169
You can also use the binary or operator to combine multiple alignment rules if necessary.
self.verticalLayout.addWidget(your_button, alignment=QtCore.Qt.AlignRight | QtCore.Qt.AlignBottom)
Upvotes: 9
Reputation: 244359
Use:
self.verticalLayout.addWidget(your_button, alignment=QtCore.Qt.AlignRight)
Upvotes: 22