[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] SIP - Managing ownership of objects in a QList
From: Matthias Kuhn <matthias.kuhn () gmx ! ch>
Date: 2013-06-28 6:56:39
Message-ID: 51CD33A7.6050805 () gmx ! ch
[Download RAW message or body]
I just realized, that this is the PyQt and not the QGIS list.
The code mentioned can be found on github [1]
If you find another (better) solution, I'll be very happy. The only
problem I encountered with the approach taken was that I initially
forgot to increase the reference counter to Py_None.
Regards,
Matthias
[1]
https://github.com/qgis/Quantum-GIS/blob/master/python/core/qgsfeature.sip
On Fre 28 Jun 2013 08:51:58 CEST, Matthias Kuhn wrote:
> Hi Michael,
>
> That's pretty much what is done in QgsAttributes (see qgsfeature.sip in
> the current master branch)
>
> Regards,
> Matthias
>
> On Fre 28 Jun 2013 04:07:59 CEST, michael h wrote:
>> I am attempting to figure out the best way make SIP transfer ownership
>> of items inside a QList to python.
>>
>> By default, the generated code for the method which returns the QList
>> contains this call:
>>
>> sipConvertFromNewType(sipRes,sipType_QList_0101SomeType,NULL);
>>
>> Is there a way to specify the transferObj as "Py_None" so we end up
>> with this instead:
>>
>> sipConvertFromNewType(sipRes,sipType_QList_0101SomeType,Py_None);
>>
>> This would cause Py_None to be passed to sipConvertToType (in the
>> generated converter function) as the transferObj argument and would
>> transfer ownership of each item in the QList to python as I need.
>>
>> Of course if there's another preferred way to get this result, I'm
>> glad to be pointed in the right direction.
>>
>> Michael
>>
>>
>> _______________________________________________
>> PyQt mailing list PyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://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