[PyQt] Re: ConvertToSubClass problem

Phil Thompson phil at riverbankcomputing.com
Tue Nov 18 09:27:05 GMT 2008


On Tue, 18 Nov 2008 01:12:49 +0100, Giovanni Bajo <rasky at develer.com>
wrote:
> Hi Phil,
> 
> this patch:
> 
> 2007/02/25  0:19:29  phil
> Included Matt Newell's fix for making sure that a sub-class convertor
> returns the most specific type available.
> 
> causes problem with PyQt3Support. Specifically, the
> ConvertToSubClassCode in q3mainwindow.sip does not seem to work as
> expected. The bug manifests itself when the code is invoked to find the
> most derived class for a Q3ListView. The convertor correctly detects the
> correct type, but this additional check (added by Matt Newell):
> 
> && !PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)subtype)
> 
> make it so that the convertor's result is ignored.
> 
> It might well be that the bug is in the placement of the convertor
> within pyqt3support. It is currently placed within Q3MainWindow, but it
> contains conversion code for many different classes (unrelated to
> Q3MainWindow). I'm afraid I'm not sure where one should place the
> convertors code.
> 
> Any guess on what exactly is the bug?

As the documentation says, the conversion code must be placed in one of the
classes that the code is handling. If the code handled unrelated classes,
how would SIP know when to invoke it?

Phil


More information about the PyQt mailing list