diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2020-04-13 16:54:08 +0100 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2020-04-13 16:54:08 +0100 |
commit | e333ef9cb80e40637235198f9c113fa8cfe0fceb (patch) | |
tree | 2ed815077bad29459a1e078c4381f802815604b6 /src/gui/tikzscene.cpp | |
parent | 732499eead71b23a7ba551fe788b47a4cf45124e (diff) |
split path works
Diffstat (limited to 'src/gui/tikzscene.cpp')
-rw-r--r-- | src/gui/tikzscene.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/gui/tikzscene.cpp b/src/gui/tikzscene.cpp index da52277..57ddb48 100644 --- a/src/gui/tikzscene.cpp +++ b/src/gui/tikzscene.cpp @@ -399,7 +399,25 @@ void TikzScene::makePath() void TikzScene::splitPath() { - // TODO: stub + QSet<Node*> selNodes; + QSet<Edge*> edges; + getSelection(selNodes, edges); + + // if no edges are selected, try to infer edges from nodes + if (edges.isEmpty()) { + foreach(Edge *e, graph()->edges()) { + if (selNodes.contains(e->source()) && selNodes.contains(e->target())) + edges << e; + } + } + + QVector<Path*> paths; + foreach (Edge *e, edges) { + Path *p = e->path(); + if (p && !paths.contains(p)) paths << p; + } + + _tikzDocument->undoStack()->push(new SplitPathCommand(this, paths)); } void TikzScene::refreshZIndices() |