diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2020-04-18 15:09:39 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2020-04-18 15:09:39 +0100 |
commit | 08ce6c91fd37c904362a5ec6f054bcd3ee061b74 (patch) | |
tree | 02be7aa5059b9926a77c040480f3fd0346236120 /src/gui/undocommands.cpp | |
parent | 5ca0a2e48d0198102dabad4af5048a53e6938fe8 (diff) |
fixed pasting for paths
Diffstat (limited to 'src/gui/undocommands.cpp')
-rw-r--r-- | src/gui/undocommands.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/undocommands.cpp b/src/gui/undocommands.cpp index 9771f44..3b1109e 100644 --- a/src/gui/undocommands.cpp +++ b/src/gui/undocommands.cpp @@ -381,6 +381,16 @@ void PasteCommand::undo() { _scene->clearSelection(); + foreach (Path *p, _graph->paths()) { + PathItem *pi = _scene->pathItems()[p]; + _scene->pathItems().remove(p); + _scene->removeItem(pi); + delete pi; + + p->removeEdges(); + _scene->graph()->removePath(p); + } + foreach (Edge *e, _graph->edges()) { EdgeItem *ei = _scene->edgeItems()[e]; _scene->edgeItems().remove(e); @@ -411,6 +421,12 @@ void PasteCommand::redo() _scene->clearSelection(); _scene->graph()->insertGraph(_graph); + foreach (Path *p, _graph->paths()) { + PathItem *pi = new PathItem(p); + _scene->pathItems().insert(p, pi); + _scene->addItem(pi); + } + foreach (Edge *e, _graph->edges()) { e->attachStyle(); // in case styles have changed EdgeItem *ei = new EdgeItem(e); |