anchor node graphics item by their center

Makes auto-positioning them somewhat easier.
This commit is contained in:
itsmattkc
2020-01-09 01:40:06 +11:00
parent b697d2faec
commit 1b34c5566d
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -69,7 +69,9 @@ NodeViewItem::NodeViewItem(QGraphicsItem *parent) :
// Use the current default font height to size this widget
// Set default "collapsed" size
title_bar_rect_ = QRectF(0, 0, widget_width, font_metrics.height() + node_text_padding_ * 2);
int widget_height = font_metrics.height() + node_text_padding_ * 2;
title_bar_rect_ = QRectF(-widget_width/2, -widget_height/2, widget_width, widget_height);
setRect(title_bar_rect_);
}