I want to put some elements of my UI in a scroll area as there can be a lot of them. I tried the following peice of code, but the area just keeps growing as I put more elements on it.

In the first part I set up a scroll area, a widget and a layout. I apply the layout to the widget and I set the widget to the scrollarea. Then I fill in my layout in an external function. The button under all of it allows to fill more elements in the layout.

Qt Code:
  1. scrollRow = QtGui.QScrollArea()
  2. scrollRow.setMaximumSize(600, 400)
  3. self.rowAssetWidget = QtGui.QWidget()
  4. self.rowAssetLayout = QtGui.QGridLayout()
  5. self.rowAssetLayout.setSpacing(20)
  6. self.rowAssetWidget.setLayout(self.rowAssetLayout)
  7. scrollRow.setWidget(self.rowAssetWidget)
  8. #self.mainLayout.addLayout(self.rowAssetLayout, 2, 0)
  9. self.mainLayout.addWidget(self.rowAssetWidget, 2, 0)
  10. self.assetRow()
  11.  
  12. self.addAssetRowBtn = QtGui.QPushButton("+")
  13. self.addAssetRowBtn.setFixedSize(20, 20)
  14. self.mainLayout.addWidget(self.addAssetRowBtn, 3, 0)
  15. self.connect(self.addAssetRowBtn, QtCore.SIGNAL("clicked()"), self.addAssetRow)
To copy to clipboard, switch view to plain text mode 

My elements appear fine, but it is not scrolling. Any idea ?