Soroush Rabiei
Soroush Rabiei

Reputation: 10868

PyQt: Right to left controls

I need my all controls to be right aligned. so when resizing they should move with the right upped corner of window instead of left upper. In visual studio, I simply set the Anchor property of any control to right and up. but PyQt has no Anchor or Dock property. Setting layoutDirection to RightToLeft didn't help.

note: I'm trying to learn PyQt using Qt Designer.

Upvotes: 0

Views: 1721

Answers (2)

will
will

Reputation: 19

It's quite easy:

# Create a layout
layout = QHBoxLayout()
# create a control
button = QPushButton("button")
# add the button to the layout and align it to the right
layout.addWidget(button, alignment=Qt.AlignRight)

Upvotes: 1

Idan K
Idan K

Reputation: 20881

Take a look at QDockWidget. This example might also be useful.

Upvotes: 0

Related Questions