[qet] [2784] Bug fix: Paste element, make new uuid for the element.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2784
Author:   blacksun
Date:     2014-01-28 11:45:45 +0100 (Tue, 28 Jan 2014)
Log Message:
-----------
Bug fix: Paste element, make new uuid for the element.
In previous version, uuid are same whith copied and paste element.

Modified Paths:
--------------
    trunk/sources/diagramcommands.cpp
    trunk/sources/qetgraphicsitem/element.h

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2014-01-27 09:15:44 UTC (rev 2783)
+++ trunk/sources/diagramcommands.cpp	2014-01-28 10:45:45 UTC (rev 2784)
@@ -301,10 +301,15 @@
 /// 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);

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2014-01-27 09:15:44 UTC (rev 2783)
+++ trunk/sources/qetgraphicsitem/element.h	2014-01-28 10:45:45 UTC (rev 2784)
@@ -105,6 +105,8 @@
 	virtual void unlinkElement(Element *elmt) {}
 	void initLink(QETProject *);
 	QList<Element *> linkedElements () const;
+	//create new uuid for this element
+	void newUuid() {uuid_ = QUuid::createUuid();}
 
 	/**
 		Draw this element


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/