PyQt QGridLayout question

Volker Lenhardt volker.lenhardt at uni-due.de
Wed Nov 23 04:35:21 EST 2005


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: volker.lenhardt at uni-duisburg-essen.de



More information about the Python-list mailing list