[PyQt] SIP template
Shaheed Haque
srhaque at theiet.org
Wed Aug 2 09:21:57 BST 2017
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!
Thanks, Shaheed
> Cheers,
> Denis
>
> Le jeu. 18 mai 2017 à 11:21, Denis Rouzaud <denis.rouzaud at gmail.com> a écrit
> :
>>
>> Hi Shaheed,
>>
>> This helped a bit, thanks a lot.
>>
>> But when doing
>> class QgsOptionalExpression : QgsOptional<QgsExpression>
>> I fall back to a syntax error on this line (on sip 4.18.1)
>>
>> I also tried to use a typedef, similarly to the example you provided:
>>
>> %ModuleHeaderCode
>> #include "qgsoptional.h"
>> %End
>> typedef QgsOptional<QgsExpression> QgsOptionalExpressionBase;
>> class QgsOptionalExpression : QgsOptionalExpressionBase
>> {
>> .....
>> }
>>
>> But I get: qgsoptionalexpression.sip:18: Super-class list contains an
>> invalid type
>>
>> It just seems not possible to inherit from a template, I wonder why it
>> works in the example you pointed and not in my case.
>>
>> Cheers,
>> Denis
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Le mer. 17 mai 2017 à 15:58, Shaheed Haque <srhaque at theiet.org> a écrit :
>>>
>>> I've possibly missed soemthing, but does this help:
>>>
>>>
>>> https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038660.html
>>>
>>> (I've not implemented this myself yet, but the SIP file certainly
>>> compiles :-))
>>>
>>> On 17 May 2017 at 09:32, Denis Rouzaud <denis.rouzaud at gmail.com> wrote:
>>> >
>>> >
>>> > Le mer. 17 mai 2017 à 10:31, Phil Thompson
>>> > <phil at riverbankcomputing.com> a
>>> > écrit :
>>> >>
>>> >> On 17 May 2017, at 8:55 am, Denis Rouzaud <denis.rouzaud at gmail.com>
>>> >> wrote:
>>> >> >
>>> >> >
>>> >> > Hi Phil,
>>> >> >
>>> >> > Thanks a lot for your reply.
>>> >> > I was hoping not to go that way to avoid any redundancy and some
>>> >> > weakness in the code (any change to the template class methods would
>>> >> > need to
>>> >> > be propagated to all implementations).
>>> >> >
>>> >> > There is no other way?
>>> >>
>>> >> I don't think so.
>>> >
>>> >
>>> > It's a pity, I thought it would have been a more common issue.
>>> > Thanks a lot for your feedback!
>>> >>
>>> >>
>>> >> Phil
>>> >>
>>> >
>>> > _______________________________________________
>>> > PyQt mailing list PyQt at riverbankcomputing.com
>>> > https://www.riverbankcomputing.com/mailman/listinfo/pyqt
More information about the PyQt
mailing list