[PyKDE] boost::shared_ptr

James Emerton james at emdata.net
Mon Mar 21 17:29:59 GMT 2005


I am rather new to PyQt/SIP and looking for a hint or two.

The application in which I am embedding Python has a fairly extensive 
(non-Qt) API, with a Qt UI sitting on top.  The API makes extensive use 
of refcounted smart pointers (boost::shared_ptr) to abstract interface 
classes.

So far, I believe that I can use the %MethodCode directive to override 
factory methods, and dynamically allocate a new instance of  the smart 
pointer, which would increment the shared_ptr reference count and 
prevent deletion so long as the python ref count was non zero.  The 
problem with this approach seems that I would also have to write 
%MethodCode to access every method in the wrapped class!

Thanks
James

--
This is not my home; the cats just let me stay here.




More information about the PyQt mailing list