[PyQt] QSqlRelationalDelegate and sizeHint
Scott Frankel
frankel at circlesfx.com
Thu Sep 10 06:22:47 BST 2009
Hello,
What's the best way to explicitly set row and column sizes for a
QTableView?
I'm trying to use an QSqlRelationalDelegate, but print statements show
that its sizeHint() method is never called. The paint() method is.
If I set the editable model methods, I lose the FK comboBoxes.
I must be missing something obvious.
Thanks in advance!
Scott
class GeneralTableDelegate(QtSql.QSqlRelationalDelegate):
def __init__(self, parent=None):
super(GeneralTableDelegate, self).__init__(parent)
print "init() ..."
def paint(self, painter, option, index):
print "paint() ..."
QtSql.QSqlRelationalDelegate.paint(self, painter, option, index)
def sizeHint(self, option, index):
print "sizeHint() ..."
if index.column() == NAME:
print "NAME ..."
return QtCore.QSize(200, 24)
elif index.column() == DESCRIPTION:
return QtCore.QSize(400, 24)
else:
return QtCore.QSize(100, 24)
return QtSql.QSqlRelationalDelegate.sizeHint(self, option, index)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqlrelationalDelegateTest.py
Type: text/x-python-script
Size: 3378 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090910/ea468b20/sqlrelationalDelegateTest-0001.bin
-------------- next part --------------
More information about the PyQt
mailing list