From 08ce6c91fd37c904362a5ec6f054bcd3ee061b74 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Sat, 18 Apr 2020 15:09:39 +0100 Subject: fixed pasting for paths --- src/gui/undocommands.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/gui/undocommands.cpp') 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); -- cgit v1.2.3