implemented clear() function for nodegraphs

Added a convenient (destructive) way of emptying a NodeGraph completely.
This commit is contained in:
itsmattkc
2019-11-23 08:48:59 +09:00
parent 9131b32be4
commit b1535b73b7
2 changed files with 15 additions and 2 deletions
+9 -1
View File
@@ -25,6 +25,14 @@ NodeGraph::NodeGraph()
}
void NodeGraph::Clear()
{
foreach (Node* node, node_children_) {
delete node;
}
node_children_.clear();
}
void NodeGraph::AddNode(Node *node)
{
if (ContainsNode(node)) {
@@ -91,7 +99,7 @@ QList<Node *> NodeGraph::TakeNodeWithItsDependencies(Node *node, QObject *new_pa
return deps;
}
QList<Node *> NodeGraph::nodes()
const QList<Node *> &NodeGraph::nodes()
{
return node_children_;
}