started parameter editor

This commit is contained in:
itsmattkc
2019-07-19 00:15:59 -07:00
parent 98bb3e8d81
commit 136bb52fef
15 changed files with 527 additions and 4 deletions
+20
View File
@@ -29,6 +29,7 @@ NodeView::NodeView(QWidget *parent) :
setDragMode(RubberBandDrag);
connect(&scene_, SIGNAL(changed(const QList<QRectF>&)), this, SLOT(ItemsChanged()));
connect(&scene_, SIGNAL(selectionChanged()), this, SLOT(SceneSelectionChangedSlot()));
}
void NodeView::SetGraph(NodeGraph *graph)
@@ -149,3 +150,22 @@ void NodeView::ItemsChanged()
}
}
}
void NodeView::SceneSelectionChangedSlot()
{
// Get the scene's selected items and convert it into a list of selected nodes
QList<QGraphicsItem*> selected_items = scene_.selectedItems();
QList<Node*> selected_nodes;
for (int i=0;i<selected_items.size();i++) {
// Try to dynamically cast to a widget holding a Node
NodeViewItem* item = dynamic_cast<NodeViewItem*>(selected_items.at(i));
if (item != nullptr) {
selected_nodes.append(item->node());
}
}
emit SelectionChanged(selected_nodes);
}
+11
View File
@@ -74,6 +74,12 @@ public:
*/
NodeViewEdge* EdgeToUIObject(NodeEdgePtr n);
signals:
/**
* @brief Signal emitted when the selected nodes have changed
*/
void SelectionChanged(QList<Node*> selected_nodes);
private:
NodeGraph* graph_;
@@ -103,6 +109,11 @@ private slots:
*/
void ItemsChanged();
/**
* @brief Receiver for when the scene's selected items change
*/
void SceneSelectionChangedSlot();
};
#endif // NODEVIEW_H