[PyQt] SIP - Managing ownership of objects in a QList

michael h michaelkenth at gmail.com
Fri Jun 28 03:07:59 BST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130627/e5775c7c/attachment.html>


More information about the PyQt mailing list