nodeview: better implementation of larger connector hitboxes

This commit is contained in:
itsmattkc
2022-07-27 12:40:27 -07:00
parent 992f3fd3af
commit 183dc8c48e
4 changed files with 21 additions and 19 deletions
@@ -81,4 +81,19 @@ void NodeViewItemConnector::SetFlowDirection(NodeViewCommon::FlowDirection dir)
setPolygon(p);
}
QPainterPath NodeViewItemConnector::shape() const
{
// Yes, we skip QGraphicsPolygonItem because it adds the polygon. QGraphicsItem adds the
// boundingRect which we modify below
return QGraphicsItem::shape(); // clazy:exclude=skipped-base-method
}
QRectF NodeViewItemConnector::boundingRect() const
{
QRectF b = this->polygon().boundingRect();
const int radius = QFontMetrics(QFont()).height()/2;
b.adjust(-radius, -radius, radius, radius);
return b;
}
}