[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] SIP template
From: Shaheed Haque <srhaque () theiet ! org>
Date: 2017-08-14 10:13:29
Message-ID: CAHAc2jf0ZYcHSAJOG07wDKbW1JohUw799C69wWMVfZQqvJ70vQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On 8 August 2017 at 22:12, Shaheed Haque <srhaque@theiet.org> wrote:
> On 8 August 2017 at 17:23, Phil Thompson <phil@riverbankcomputing.com>
> wrote:
> > On 2 Aug 2017, at 9:21 am, Shaheed Haque <srhaque@theiet.org> wrote:
> >>
> >> Hi,
> >>
> >> On 18 May 2017 at 13:14, Denis Rouzaud <denis.rouzaud@gmail.com> wrote:
> >>>
> >>> Sorry, for the noise.
> >>>
> >>> I missed the second typedef in the ModuleHeaderCode, it works!
> >>> Thanks to David, Phil and Shaheed for the hints!
> >>
> >> Is there a variation on this technique that works for nested classes?
> >> It turns out that in all 17 places this affects PyKF5 involve nested
> >> classes, and attempting to modify this SIP:
> >>
> >> =============
> >> namespace KContacts
> >> {
> >> class AddresseeList: QVector<KContacts::Addressee>
> >> {
> >> =============
> >>
> >> into this SIP:
> >>
> >> =============
> >> namespace KContacts
> >> {
> >> %TypeHeaderCode
> >> typedef QVector<KContacts::Addressee> foo_t;
> >> %End
> >> typedef QVector<KContacts::Addressee> foo_t;
> >> class AddresseeList: KContacts::foo_t
> >> {
> >> =============
> >>
> >> only results in:
> >>
> >> sip: tmp/KContacts/KContacts/AddresseeList.sip:121: Super-class list
> >> contains an invalid type
> >>
> >> I stared a the code that emits the message in parser.y (and also tried
> >> moving foo_t to global scope), without the solution becoming obvious.
> >> So, any clues or ideas welcomed!
> >
> > PyQt has the same problem with QPolygon. The workaround is to say that
> AddresseeList does not have a super-class and to add any QVector methods
> you want to AddresseeList. See qpolygon.sip in PyQt.
>
> Thanks Phil...
>
I'm still working on variations of this topic. The problem I am having at
the moment is that a sequence like this, where Bar has a base which is a
%MappedType:
=======
%Module(name=xxx)
%MappedType FooBad
{
%ConvertFromTypeCode
// blah.
%End
%ConvertToTypeCode
// blah.
%End
};
class FooOK
{
public:
FooOK();
};
class Bar: FooBad
{ <<<<<<<<<<<<<<<< This is line 20
public:
Bar();
};
=======
gives the error "sip: tmp.sip:20: A class, exception, namespace or mapped
type has already been defined with the same name" but if I change the base
class from FooBad to the non-%MappedType normal class FooOK, it compiles
just fine. I'm on 4.19.4.dev1708081632...have I gone mad?
Thanks, Shaheed
> >
> > Phil
>
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 August 2017 at \
22:12, Shaheed Haque <span dir="ltr"><<a href="mailto:srhaque@theiet.org" \
target="_blank">srhaque@theiet.org</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On \
8 August 2017 at 17:23, Phil Thompson <<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> \
wrote:<br> > On 2 Aug 2017, at 9:21 am, Shaheed Haque <<a \
href="mailto:srhaque@theiet.org">srhaque@theiet.org</a>> wrote:<br> >><br>
>> Hi,<br>
>><br>
>> On 18 May 2017 at 13:14, Denis Rouzaud <<a \
href="mailto:denis.rouzaud@gmail.com">denis.rouzaud@gmail.com</a>> wrote:<br> \
>>><br> >>> Sorry, for the noise.<br>
>>><br>
>>> I missed the second typedef in the ModuleHeaderCode, it works!<br>
>>> Thanks to David, Phil and Shaheed for the hints!<br>
>><br>
>> Is there a variation on this technique that works for nested classes?<br>
>> It turns out that in all 17 places this affects PyKF5 involve nested<br>
>> classes, and attempting to modify this SIP:<br>
>><br>
>> =============<br>
>> namespace KContacts<br>
>> {<br>
>> class AddresseeList: QVector<KContacts::Addressee><br>
>> {<br>
>> =============<br>
>><br>
>> into this SIP:<br>
>><br>
>> =============<br>
>> namespace KContacts<br>
>> {<br>
>> %TypeHeaderCode<br>
>> typedef QVector<KContacts::Addressee> foo_t;<br>
>> %End<br>
>> typedef QVector<KContacts::Addressee> foo_t;<br>
>> class AddresseeList: KContacts::foo_t<br>
>> {<br>
>> =============<br>
>><br>
>> only results in:<br>
>><br>
>> sip: tmp/KContacts/KContacts/<wbr>AddresseeList.sip:121: Super-class \
list<br> >> contains an invalid type<br>
>><br>
>> I stared a the code that emits the message in parser.y (and also tried<br>
>> moving foo_t to global scope), without the solution becoming obvious.<br>
>> So, any clues or ideas welcomed!<br>
><br>
> PyQt has the same problem with QPolygon. The workaround is to say that \
AddresseeList does not have a super-class and to add any QVector methods you want to \
AddresseeList. See qpolygon.sip in PyQt.<br> <br>
</div></div>Thanks Phil...<br></blockquote><div><br></div><div>I'm still working \
on variations of this topic. The problem I am having at the moment is that a sequence \
like this, where Bar has a base which is a \
%MappedType:<br><br>=======<br>%Module(name=xxx)<br><br>%MappedType \
FooBad<br>{<br>%ConvertFromTypeCode<br>// blah.<br>%End<br>%ConvertToTypeCode<br>// \
blah.<br>%End<br>};<br><br>class FooOK<br>{<br>public:<br> \
FooOK();<br>};<br><br>class Bar: FooBad<br></div><div>{ \
<<<<<<<<<<<<<<<< This is line \
20<br></div><div>public:<br> Bar();<br>};<br>=======<br><br></div><div>gives \
the error "sip: tmp.sip:20: A class, exception, namespace or mapped type has \
already been defined with the same name" but if I change the base class from \
FooBad to the non-%MappedType normal class FooOK, it compiles just fine. I'm on \
4.19.4.dev1708081632...have I gone mad?<br></div><div><br></div><div>Thanks, \
Shaheed<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px \
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> ><br>
> Phil<br>
</blockquote></div><br></div></div>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic