[PyKDE] Deep copy
Vio
vmilitaru at sympatico.ca
Tue Jul 22 06:19:01 BST 2003
Hi,
I need to implement copy/cut/paste of whole Pyqt objects. This
apparently requires 'deep copies' of a target object: one initial copy
used as the 'clipboard' object (my cookie-cutter), then all other copies
created by 'deep-copying' the clipboard object.
Now is there an easy way to make 'deep copies' of PyQt objects? The
assignment operator '=' only makes so-called 'shallow' copies, which are
simple references to an object. I need real duplicate objects, which are
independent of each other (modifying one copy should have no affects on
the other copies).
So what are my options besides manually reconstructing the object
(calling the PyQt constructor and copying each data element into the new
instance sounds costly)? And python's 'copy' module unfortunately chokes
on objects:
"copy.deepcopy(obj)" bombs unfortunately:(
Or are there better ways of achieving this.
Cheers,
Vio
More information about the PyQt
mailing list