diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index cd02637f1..60a3c3f9e 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -301,10 +301,15 @@ void PasteDiagramCommand::undo() { /// refait le coller void PasteDiagramCommand::redo() { diagram -> showMe(); - if (first_redo) first_redo = false; + if (first_redo) { + first_redo = false; + //this is the first paste, we make new uuid for each element + //because old uuid are the uuid of the copied element + foreach(Element *e, content.elements) e->newUuid(); + } else { // paste the elements - foreach(Element *e, content.elements) diagram -> addElement(e); + foreach(Element *e, content.elements) diagram -> addElement(e); // paste the conductors foreach(Conductor *c, content.conductorsToMove) diagram -> addConductor(c); diff --git a/sources/qetgraphicsitem/element.h b/sources/qetgraphicsitem/element.h index b39bff407..9212d29c3 100644 --- a/sources/qetgraphicsitem/element.h +++ b/sources/qetgraphicsitem/element.h @@ -105,6 +105,8 @@ class Element : public QetGraphicsItem { virtual void unlinkElement(Element *elmt) {} void initLink(QETProject *); QList linkedElements () const; + //create new uuid for this element + void newUuid() {uuid_ = QUuid::createUuid();} /** Draw this element