[PyQt] SIP template

Shaheed Haque srhaque at theiet.org
Tue Aug 8 22:12:36 BST 2017


On 8 August 2017 at 17:23, Phil Thompson <phil at riverbankcomputing.com> wrote:
> On 2 Aug 2017, at 9:21 am, Shaheed Haque <srhaque at theiet.org> wrote:
>>
>> Hi,
>>
>> On 18 May 2017 at 13:14, Denis Rouzaud <denis.rouzaud at 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...

>
> Phil


More information about the PyQt mailing list