ensure objects are in the correct thread when loading

Since we load in a separate thread, when the QObject based objects are
instantiated, they're created with affinity to that separate thread. Now we
specifically ensure they are moved to the main thread after their creation.
This commit is contained in:
itsmattkc
2020-01-14 00:10:21 +11:00
parent 16878e3c25
commit 0ea98be443
19 changed files with 231 additions and 134 deletions
+4 -4
View File
@@ -41,8 +41,8 @@ void NodeGraph::AddNode(Node *node)
node->setParent(this);
connect(node, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SIGNAL(EdgeAdded(NodeEdgePtr)));
connect(node, SIGNAL(EdgeRemoved(NodeEdgePtr)), this, SIGNAL(EdgeRemoved(NodeEdgePtr)));
connect(node, &Node::EdgeAdded, this, &NodeGraph::EdgeAdded);
connect(node, &Node::EdgeRemoved, this, &NodeGraph::EdgeRemoved);
node_children_.append(node);
@@ -62,8 +62,8 @@ void NodeGraph::TakeNode(Node *node, QObject* new_parent)
node->DisconnectAll();
disconnect(node, SIGNAL(EdgeAdded(NodeEdgePtr)), this, SIGNAL(EdgeAdded(NodeEdgePtr)));
disconnect(node, SIGNAL(EdgeRemoved(NodeEdgePtr)), this, SIGNAL(EdgeRemoved(NodeEdgePtr)));
disconnect(node, &Node::EdgeAdded, this, &NodeGraph::EdgeAdded);
disconnect(node, &Node::EdgeRemoved, this, &NodeGraph::EdgeRemoved);
node->setParent(new_parent);