[PyKDE] SIP automatically casting up to a QWidget

Phil Thompson phil at riverbankcomputing.co.uk
Thu Feb 22 14:32:05 GMT 2007


On Thursday 22 February 2007 1:53 pm, Paul Giannaros wrote:
> I have a class A that i'm wrapping with SIP. The class inherits from a
> bunch of other classes. One of the classes it inherits from also in turn
> inherits from QWidget. When I import the created module, whenever I call a
> method that is meant to return an instance of class A I get a QWidget
> instead. I can use sip.cast to get the QWidget back to an A instance, but
> that's not a very friendly solution.
> Can someone suggest why this is happening, or how to fix it?

You need to implement %ConvertToSubClassCode that handles A (and any other 
QObject derived classes in your module).

Phil




More information about the PyQt mailing list