Reputation: 19379
A simple QtGui.QListWidget
is placed inside of a QtGui.QFormLayout
.
This list widget's sides are beautifully stick to the side edges of the main dialog box but not to the dialog's bottom or top edge. The list widget re-sizes itself only when a main dialog window gets wider or slimmer and not when it gets taller and shorter.
How can we make a widget placed inside of QFormLayout
stick to the bottom edge of the dialog window?
Upvotes: 0
Views: 757
Reputation: 17485
Use QSizePolicy.setVerticalStretch
:
import PyQt4.QtGui as gui
app = gui.QApplication([])
w = gui.QWidget()
la = gui.QFormLayout()
w.setLayout(la)
tw = gui.QTreeWidget()
sp = tw.sizePolicy()
sp.setVerticalStretch(1)
tw.setSizePolicy(sp)
la.addWidget(tw)
w.show()
app.exec_()
Upvotes: 3