[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] subclassing QSqlTableModel
From: Pavel Brych <pavel () brych ! cz>
Date: 2011-09-23 11:43:59
Message-ID: 4E7C70FF.8030100 () brych ! cz
[Download RAW message or body]
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, paolo@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: pavel@brych.cz
ICQ: 304482700
Jabber: pavel.brych@jabber.cz
Skype: pavel.brych
MSN: pavel@brych.cz
WWW: http://brych.cz
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic