[PyQt] QList Specialization Class SIP Error

Phil Thompson phil at riverbankcomputing.com
Sun Oct 17 21:13:35 BST 2010


On Sun, 17 Oct 2010 21:07:55 +0100, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Sat, 16 Oct 2010 19:40:02 +0200, James Meyer <jamesm at lantic.net>
wrote:
>> Hi
>> 
>> I have a C++ class that extends QList, or more specifically
QList<Point>
> 
>> where Point is one of our custom classes.
>> SIP gives me a syntax error as soon as I add the template parameter to 
>> the inheritance.
>> 
>> In C++:
>> class PointList : public QList<Point> {
>> ...
>> };
>> 
>> In SIP:
>> class PointList : QList<Point> {
>> %TypeHeaderCode
>> #include <PointList.h>
>> %End
>> ...
>> };
>> 
>> How am I suppose to specify this inheritance in the SIP file?
> 
> You have to implement PointList as a %MappedType.

...or as a class with no super-classes and explicitly define those QList
methods you want to access from Python. See PyQt's implementation of
QPolygon.

Phil


More information about the PyQt mailing list