Hi Paolo,

you must return your flags like this:

    def flags(self, index):
        return QSqlTableModel.flags(self, index)

Otherwise your method returns None.

Pavel

Dne 23.9.2011 13:28, pa...@paolodestefani.it napsal(a):
> 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
> 
> 
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

-- 
Pavel Brych
=============================
tel:    721116063
mail:   pa...@brych.cz
ICQ:    304482700
Jabber: pavel.br...@jabber.cz
Skype:  pavel.brych
MSN:    pa...@brych.cz
WWW:    http://brych.cz
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to