PyQt layout question: QScrollView and QGridLayout?

Phil Thompson phil at riverbankcomputing.co.uk
Thu Nov 17 12:53:42 EST 2005


On Thursday 17 November 2005 2:56 pm, Volker Lenhardt wrote:
> For a QApplication (PyQt) on the small screen of my Zaurus 5500 PDA I
> try to layout my data output in a QScrollView as the central widget. I'd
> prefer to use QGridLayout, but cannot add it to the scroll view.
>
> sc=QScrollView(self)
> layout=QGridLayout(..., sc.viewport())
> sc.addChild(layout)
>
> results in a TypeError.
>
> Is there a way to get it to work? Filling a box viewport with lots of
> padding boxes and white space labels to establish grids is very
> cumbersome. And I need 4 different layouts to change places.

QGridLayout is not a sub-class of QWidget, which is what addChild() is 
expecting. You probably want QGrid.

Phil



More information about the Python-list mailing list