[PyQt] sip.cast changes behaviour of == operator?

Andreas Pakulat apaku at gmx.de
Mon Feb 21 20:30:28 GMT 2011


Hi,

still working on the modeltest.py code, picking up one of the older
threads about it:
 http://www.opensubscriber.com/message/pyqt@riverbankcomputing.com/10335500.html

As far as I can see the reason for this is the casting done at the start
of the ModelTest class. It looks like sip.cast changes the behaviour of
comparing the references in this code:

assert( index.model() == self.model )

index.model() is a QStringListModel instance, self.model is a
QAbstractItemModel and both have different internal id's.

And it seems like sip.cast creates a new wrapped instance each time,
simply doing a sip.cast() for the index.model() call does not help.

Is that intentional (I guess so) and is there a way to still get the
assertion to work as it should?

Andreas

-- 
Be careful!  Is it classified?


More information about the PyQt mailing list