I am trying to make my QGroupBox
scrollable once it grows higher than 400px. The contents in the QGroupBox
are generated using a for-loop. This is an example of how it was done:
mygroupbox = QtGui.QGroupBox('this is my groupbox')
myform = QtGui.QFormLayout()
labellist = []
combolist = []
for i in range(val):
labellist.append(QtGui.QLabel('mylabel'))
combolist.append(QtGui.QComboBox())
myform.addRow(labellist[i],combolist[i])
mygroupbox.setLayout(myform)
Since the value of val
depends on some other factors, the myform
layout size could not be determined. In order to solve this, i added a QScrollableArea
like this:
scroll = QtGui.QScrollableArea()
scroll.setWidget(mygroupbox)
scroll.setWidgetResizable(True)
scroll.setFixedHeight(400)
Unfortunately, that doesn't seem to make any effect on the groupbox: there's no sign of a scrollbar. Am i missing somthing?