Bug fix: Paste element, make new uuid for the element.

In previous version, uuid are same whith copied and paste element.


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2784 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-01-28 10:45:45 +00:00
parent 760886e6dc
commit c3042460e2
2 changed files with 9 additions and 2 deletions

View File

@@ -301,7 +301,12 @@ 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);

View File

@@ -105,6 +105,8 @@ class Element : public QetGraphicsItem {
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