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).
With: python colspan.py 1 All three widgets are drawn with the same width. Which is right. But starting with: 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 http://www.NaN-tic.com Mòbil: +34 669 40 40 18
from PyQt4.QtCore import * from PyQt4.QtGui import * import sys if len(sys.argv) != 2: print "Syntax: %s colspan" % sys.argv[0] sys.exit(1) colspan=int(sys.argv[1]) app = QApplication(sys.argv) dialog = QDialog() dialog.show() edit1 = QLineEdit(dialog) edit2 = QLineEdit(dialog) edit3 = QLineEdit(dialog) layout = QGridLayout(dialog) layout.addWidget( edit1, 0, 0, 1, colspan ) layout.addWidget( edit2, 0, colspan, 1, 1 ) layout.addWidget( edit3, 0, colspan + 1, 1, 1 ) app.exec_()
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
