[PyQt] multiple inheritance and MappedType

Phil Thompson phil at riverbankcomputing.com
Fri Jul 2 08:49:27 BST 2010


On Thu, 1 Jul 2010 15:51:48 -0600, Clinton Stimpson <cjstimpson at gmail.com>
wrote:
> Hi,
> 
> I've got an existing library with python wrappers generated with a
> different 
> tool, and I've successfully used MappedType to interface with that and
I'm 
> getting the interoperability I'm looking for.
> 
> But now I want to use sip to wrap a class that derives from two classes,
> one 
> is QObject, and the other is a MappedType.
> 
> I'm getting an error from sip:
> "A class, exception, namespace or mapped type has already been defined
with
> the 
> same name"
> 
> Is inheritance from a MappedType not supported?

Correct.

An alternative approach is to invent a new class (as far as SIP is
concerned) which you can sub-class from.

For example, in Qt QItemSelection is sub-classed from
QList<QItemSelectionRange> (which would be implemented as a MappedType). 
In PyQt QItemSelection isn't sub-classed from anything but has the useful
methods from QList added.

Phil


More information about the PyQt mailing list