JuanPablo
JuanPablo

Reputation: 24754

PySide: set width of QVBoxLayout

With PySide, I have a set of QWidget in a QVBoxLayout

vlayout = QVBoxLayout()
vlayout.addWidget(self.a_label)
vlayout.addWidget(self.a)

I can set the width of widget with

self.a.setFixedWidth(60)

but If I try set the width of QVBoxLayout with setGeometry

vlayout.setGeometry(QRect(100, 100, 100, 100))

I don't get changes.

How I can set the width of a QVBoxLayout ?

Upvotes: 11

Views: 19705

Answers (1)

JuanPablo
JuanPablo

Reputation: 24754

I solved, putting the QVBoxLayout in a QWidget and fixed the width of QWidget

v_widget = QWidget()
v_widget.setLayout(vlayout)
v_widget.setFixedWidth(80)

Upvotes: 20

Related Questions