nodeview: update positions correctly
This commit is contained in:
@@ -45,7 +45,8 @@ NodeViewItem::NodeViewItem(QGraphicsItem *parent) :
|
||||
expanded_(false),
|
||||
hide_titlebar_(false),
|
||||
highlighted_index_(-1),
|
||||
flow_dir_(NodeViewCommon::kLeftToRight)
|
||||
flow_dir_(NodeViewCommon::kLeftToRight),
|
||||
dont_signal_(false)
|
||||
{
|
||||
// Set flags for this widget
|
||||
setFlag(QGraphicsItem::ItemIsMovable);
|
||||
@@ -336,6 +337,10 @@ QVariant NodeViewItem::itemChange(QGraphicsItem::GraphicsItemChange change, cons
|
||||
{
|
||||
if (change == ItemPositionHasChanged && node_) {
|
||||
ReadjustAllEdges();
|
||||
|
||||
if (!dont_signal_) {
|
||||
emit NodePositionChanged(GetNodePosition());
|
||||
}
|
||||
}
|
||||
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
@@ -479,6 +484,8 @@ QPointF NodeViewItem::GetInputPointInternal(int index, const QPointF& source_pos
|
||||
|
||||
void NodeViewItem::UpdateNodePosition()
|
||||
{
|
||||
dont_signal_ = true;
|
||||
|
||||
const QPointF &pos = cached_node_pos_;
|
||||
|
||||
switch (flow_dir_) {
|
||||
@@ -499,6 +506,8 @@ void NodeViewItem::UpdateNodePosition()
|
||||
-pos.x() * DefaultItemVerticalPadding());
|
||||
break;
|
||||
}
|
||||
|
||||
dont_signal_ = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user