[PyQt] How to derive from a %MappedType?

Shaheed Haque srhaque at theiet.org
Sun Jan 22 15:49:16 GMT 2017


Hi all,

I'm having trouble with %MappedType with roughly the following in C++:

================
class Outer
{
    class Inner: KConfigSkeletonGenericItem<QString>
    {
    };
};
================

Now, if a do a roughly literal translation to .sip, the SIP compiler
flags a syntax error for the declaration of Inner. This seems to be
caused by the "<QString>". I had understood that a %MappedType could
be relied to fill in whereever it was encountered, even in a base
class specifier but since the specification syntax suggest it looks
for a simple name in the list of base classes, I tried inserting a
"typedef" with the resulting .sip looking roughly like this (in
practice, there is a %Module and some %Include'ing etc going on):

================
class Outer
{
    typedef KConfigSkeletonGenericItem<QString>
KConfigSkeletonGenericItem_QString;
    class Inner: KConfigSkeletonGenericItem_QString
    {
    };
};

%MappedType KConfigSkeletonGenericItem<QString>
{
};
================

That addresses the syntax error, but now it complains
"KConfigSkeletonGenericItem_QString has not been defined". (I also
tried moving the %MappedType to before the Outer class, to no avail).

Have I misunderstood something basic about how %MappedType works, or
something else incorrect?

Thanks, Shaheed


More information about the PyQt mailing list