Hi
I'm just looking at the QgsGraduatedSymbolRendererV2 SIP and wanting to check
my understanding of the use of /Transfer/
I think this is used to transfer ownership of an object. So for example the
renderer includes the member function
void setSourceColorRamp( QgsVectorColorRampV2* ramp /Transfer/ );
So this could be used from python with code something like
ramp=myColorRamp()
renderer.setSourceColorRamp(ramp)
However if you were using the same ramp in two places, then you'd need to make
sure that you didn't pass the same object to both, so you might have something
like
ramp=myColorRamp()
renderer1.setSourceColorRamp(ramp.clone())
renderer2.setSourceColorRamp(ramp.clone())
Is this right?
If so, then I wonder if having to pay attention to this sort of memory
allocation/ownership issue is not very "pythonic".
Would it be better to set up the SIP so that it always used the clone()
function, and so that a python coder didn't have think about whether they might
have yielded ownership of a python object. Presumably there is a way to write
the SIP to do this? And would this create issues in those environments (eg
windows 64) where the transfer function doesn't seem to work reliably, and
python subclassed objects need to be deliberately kept alive?
Cheers
Chris
This message contains information, which may be in confidence and may be
subject to legal privilege. If you are not the intended recipient, you must not
peruse, use, disseminate, distribute or copy this message. If you have received
this message in error, please notify us immediately (Phone 0800 665 463 or
[email protected]) and destroy the original message. LINZ accepts no
responsibility for changes to this email, or for any attachments, after its
transmission from LINZ. Thank You.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer