PyQt layout question: QScrollView and QGridLayout?
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. Best wishes Volker -- Volker Lenhardt E-Mail: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt layout question: QScrollView and QGridLayout?
Phil Thompson schrieb: > On Thursday 17 November 2005 2:56 pm, Volker Lenhardt wrote: > >>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 I hoped to find a more assuring answer. There's no MultiCellWidget, no Col/RowStretching, no Col/RowSpacing in QGrid. I've got to patch up one VBox with a whole bunch of QV/QHBoxes and QGrids not to mention the white space QLabels to fill not used grid cells. And I have to delete all of them to change to another data layout. Are you sure that there's no way to fill a QScrollView with the help of some QLayout? Still hopefully Volker -- http://mail.python.org/mailman/listinfo/python-list
Re: PyQt layout question: QScrollView and QGridLayout?
Thank you Don, thank you David, I was convinced that there must be a simple solution at hand. A dummy widget! It does work to my needs. Don's ScrollToolView is very interesting though not yet the right tool for my actual application, but I've got some more ideas for long winter nights ... All the best Volker -- http://mail.python.org/mailman/listinfo/python-list
PyQt QGridLayout question
Once again a maybe silly question, but I find no solution, neither in the documentation nor in examples. I have got some different layouts to change place by the help of a QGridLayout in its parent widget. To make it nice I use row/col spacing and stretch respectively as well as multicell widgets. There is no problem if the layout next to come uses more rows and columns than the former one. But if it is the other way round, the grid seems to take those now unused rows and columns into account and uses more space than expected. Before changing to another layout I remove and delete all widgets within the grid and set spacing and stretch of all used rows and columns to 0: for c in self.gridContents.values(): self.grid.removeChild(c) self.gridContents.clear() for i in range(20): self.grid.addColSpacing(i,0) self.grid.addRowSpacing(i,0) self.grid.setColStretch(i,0) self.grid.setRowStretch(i,0) Only if I do a total resection and remove the grid and the parent widget, too, to set them up again, all is fine but for the flicker on the screen. Is there a more convenient way? Remove rows/columns as can be done in tables? Best wishes Volker -- Volker Lenhardt E-Mail: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list