[PyKDE] QListView(Item) subclass insertItem strange behaviou

Jim Bublitz jbublitz at nwinternet.com
Sun Jan 5 08:35:01 GMT 2003


On 04-Jan-03 marvelan L wrote:

> The problem is that I need to access my own added methods in
> MyList when insertItem is called. But it seems that it is called
> with a object of the base class and not my specialisation class
> MyList.

Since it's printing, it would seem that the overloaded methods are
being called correctly. You can test which object (base or sub
class) is actually instantiated by calling a subclass-only method
using the object in question. If the object is of the base class
type, the call to a subclass method will fail.

I'm not sure how __class__ works with PyQt classes, but if it uses
QObject.className in some way, it's unlikely to report a
Python-created subclass correctly. From your post, it doesn't appear
that what __class__ returns is important, but just that the correct
object type is instantiated.

Jim




More information about the PyQt mailing list