[PyQt] subclassing QSqlTableModel
paolo at paolodestefani.it
paolo at paolodestefani.it
Fri Sep 23 12:28:05 BST 2011
I'm using python 3.2 and pyqt 4.8.5 on windows 7 32bit
I'm trying to understand how subclassing QSqlTableModel works and i don't
understand why this code fail:
class StaffModel(QSqlTableModel):
def __init__(self, parent):
QSqlTableModel.__init__(self, parent)
self.setTable("staff")
def flags(self, index):
QSqlTableModel.flags(self, index)
I use this model in a tableview and what i get is this messages:
TypeError: invalid result type from StaffModel.flags()
TypeError: invalid result type from StaffModel.flags()
TypeError: invalid result type from StaffModel.flags()
TypeError: invalid result type from StaffModel.flags()
(...)
If i delete the flags() method, so that StaffModel is the same of
QSqlTableModel but with 'preloaded' the table name, everything works as
expected.
Looks Like i can not redefine methods ?
Thanks.
Paolo
More information about the PyQt
mailing list