summaryrefslogtreecommitdiff
path: root/src/gui/undocommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/undocommands.cpp')
-rw-r--r--src/gui/undocommands.cpp16
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);