[Uml-devel] removed clone() and copyInto()

Andi Fischer andi.fischer at hispeed.ch
Sat May 15 15:48:25 UTC 2010


On 05/14/2010 12:00 AM, Eike Krumbacher wrote:
> Today I was wondering, what this clone() and copyInto() might be.
>
> Well, at least
> * refactoring/refactoringassistant.cpp and
> * dialogs/umloperationdialog.cpp
> uses this for some purpose. There are copies of things made with
> clone(). The Clones are then used to to change some attribute settings.
> The settings are then written back to the original one with copyInto()
> and then the clones are deleted. As far as I understand this.
>
>
> Then I tried to do the same with copy constructor.
>
> + added a copy constructor at umlobject.cpp and .h
> + removed clone() and copyInto() from where ever I found them
> + made the above code work with copy constructors.
> + tested with actor widgets and class widgets and their respective
> attributes.
>
> Is it really that easy to save 100 or so lines without breaking
> functionality? Please check the attached patch if I missed something.
>
> * patch is from /soc-umbrello/umbrello/
> * sorry for zipping, but list does not accept large attachments.
>
> Eike

Hi all!

I tested the nice patch from Eike. I only added a parent initialization 
in the copy constructor due to a compiler warning:
/**
  * Copy constructor.
  */
UMLObject::UMLObject(const UMLObject &u)
   : QObject(u.parent())
{

I haven't seen any problem.

But I remember that there is some Qt macro Q_DISABLE_COPY(class)
and after "googeling" I found very quickly
http://lists.trolltech.com/qt-interest/2006-01/msg00621.html

What shall we do with the patch? Do we need the clone() and copyInto() 
methods?
Please, give some advice, feedback, experience. Shall we post a question 
on kde-devel?

Regards,

Andi




More information about the umbrello-devel mailing list