nodeview: further optimization of node view

This commit is contained in:
itsmattkc
2020-03-03 01:50:31 +11:00
parent 644dd2df30
commit d8f83f1452
3 changed files with 9 additions and 7 deletions
+3 -7
View File
@@ -147,14 +147,10 @@ void NodeView::SelectWithDependencies(QList<Node *> nodes)
void NodeView::ItemsChanged()
{
QList<QGraphicsItem*> items = scene_.items();
QHash<NodeEdge *, NodeViewEdge *>::const_iterator i;
foreach (QGraphicsItem* item, items) {
NodeViewEdge* edge = dynamic_cast<NodeViewEdge*>(item);
if (edge != nullptr) {
edge->Adjust();
}
for (i=scene_.edge_map().begin();i!=scene_.edge_map().end();i++) {
i.value()->Adjust();
}
}
+5
View File
@@ -47,6 +47,11 @@ const QHash<Node *, NodeViewItem *> &NodeViewScene::item_map() const
return item_map_;
}
const QHash<NodeEdge *, NodeViewEdge *> &NodeViewScene::edge_map() const
{
return edge_map_;
}
void NodeViewScene::AddNode(Node* node)
{
NodeViewItem* item = new NodeViewItem();
+1
View File
@@ -39,6 +39,7 @@ public:
void SetGraph(NodeGraph* graph);
const QHash<Node*, NodeViewItem*>& item_map() const;
const QHash<NodeEdge*, NodeViewEdge*>& edge_map() const;
public slots:
/**