disambiguated whether NodeParam::parent() would return a Node* or a QObject*

Old code assumes that a NodeParam's parent will always be a Node. The function
has been separated off and tweaked in the event that this is not the case.
This commit is contained in:
itsmattkc
2019-11-30 23:58:56 +11:00
parent a478b11fd0
commit 092d76f41a
15 changed files with 72 additions and 43 deletions
+3 -3
View File
@@ -304,7 +304,7 @@ void NodeViewItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
drag_src_param_ = edge->output();
// Get its Node UI object
drag_source_ = NodeView::NodeToUIObject(scene(), drag_src_param_->parent());
drag_source_ = NodeView::NodeToUIObject(scene(), drag_src_param_->parentNode());
// Get the opposing parameter's rect center using the line's current coordinates
// (we use the current coordinates because a complex formula is used for the line's coords if the opposing
@@ -387,11 +387,11 @@ void NodeViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// Determine which Node will be "submitting output" and which node will be "receiving input"
if (drag_src_param_->type() == NodeParam::kInput) {
receiving_node = drag_src_param_->parent();
receiving_node = drag_src_param_->parentNode();
outputting_node = drop_item->node();
} else {
receiving_node = drop_item->node();
outputting_node = drag_src_param_->parent();
outputting_node = drag_src_param_->parentNode();
}
// Ensure the receiving node doesn't output to the outputting node