On Tuesday 22 July 2003 2:18 am, Vio wrote: > 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.
You can't do it. For one thing, there is no mechanism to invoke the copy ctor of the underlying C++ instance. Secondly many (most?) Qt classes are designed not to be copied - they have declared private copy ctors and assignment operators. Phil _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
