[PyQt] Understanding QGridLayout colspan

Albert Cervera i Areny albert at nan-tic.com
Mon Aug 17 13:54:04 BST 2009

I've got a problem undestanding how colspan parameter in 
QGridLayout.addWidget() function works. Indeed, IMHO it's broken.
The attached example accepts a number as argument which is the colspan of the 
first QLineEdit (out of three).


python colspan.py 1

All three widgets are drawn with the same width. Which is right. But starting 

python colspan.py 2

(and up) the first widget (which is assigned colspan="2") uses LESS space than 
the other two. So if we have three widgets with colspan 2, 1, 1 respectively 
the one with higher colspan is smaller than the other two! Shouldn't this be 
the other way round? Those with higher colspan take up more space?

Albert Cervera i Areny
Mòbil: +34 669 40 40 18
-------------- next part --------------
A non-text attachment was scrubbed...
Name: colspan.py
Type: text/x-python
Size: 494 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090817/75cdd46b/colspan.py

More information about the PyQt mailing list