[PyQt] QList Specialization Class SIP Error
Hi I have a C++ class that extends QList, or more specifically QList 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 { ... }; In SIP: class PointList : QList { %TypeHeaderCode #include %End ... }; How am I suppose to specify this inheritance in the SIP file? Thanks James ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QList Specialization Class SIP Error
On Sat, 16 Oct 2010 19:40:02 +0200, James Meyer wrote: > Hi > > I have a C++ class that extends QList, or more specifically QList > 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 { > ... > }; > > In SIP: > class PointList : QList { > %TypeHeaderCode > #include > %End > ... > }; > > How am I suppose to specify this inheritance in the SIP file? You have to implement PointList as a %MappedType. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QList Specialization Class SIP Error
On Sun, 17 Oct 2010 21:07:55 +0100, Phil Thompson wrote: > On Sat, 16 Oct 2010 19:40:02 +0200, James Meyer wrote: >> Hi >> >> I have a C++ class that extends QList, or more specifically QList > >> 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 { >> ... >> }; >> >> In SIP: >> class PointList : QList { >> %TypeHeaderCode >> #include >> %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 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QList Specialization Class SIP Error
Hi Thanks for the reply. Sorry to be a pain, but I'm quite new to SIP. How exactly would I implement this as a mapped type? Do I only need to specify the %ConvertToTypeCode and %ConvertFromTypeCode directives similar to QList itself. Will I reference QList at all in the mapped type specification? Thanks James On 2010/10/17 10:13 PM, Phil Thompson wrote: On Sun, 17 Oct 2010 21:07:55 +0100, Phil Thompson wrote: On Sat, 16 Oct 2010 19:40:02 +0200, James Meyer wrote: Hi I have a C++ class that extends QList, or more specifically QList 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 { ... }; In SIP: class PointList : QList { %TypeHeaderCode #include %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 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] QList Specialization Class SIP Error
On Sun, 17 Oct 2010 23:15:37 +0200, James Meyer wrote: > Hi > Thanks for the reply. > Sorry to be a pain, but I'm quite new to SIP. How exactly would I > implement this as a mapped type? > Do I only need to specify the %ConvertToTypeCode and > %ConvertFromTypeCode directives similar to QList itself. > Will I reference QList at all in the mapped type specification? Have a look at qlist.sip from PyQt. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt