@@ -69,7 +69,7 @@ Edge::Edge(NodeP sourceNode, NodeP targetNode, bool enableAnimations, bool enabl
6969 m_label->setZValue (static_cast <int >(Layers::EdgeLabel));
7070 m_label->setBackgroundColor (Constants::Edge::LABEL_COLOR);
7171
72- connect (m_label, &TextEdit::textChanged, [=](const QString & text) {
72+ connect (m_label, &TextEdit::textChanged, this , [=](const QString & text) {
7373 updateLabel ();
7474 m_text = text;
7575 });
@@ -79,7 +79,7 @@ Edge::Edge(NodeP sourceNode, NodeP targetNode, bool enableAnimations, bool enabl
7979 m_labelVisibilityTimer.setSingleShot (true );
8080 m_labelVisibilityTimer.setInterval (Constants::Edge::LABEL_DURATION);
8181
82- connect (&m_labelVisibilityTimer, &QTimer::timeout, [=] {
82+ connect (&m_labelVisibilityTimer, &QTimer::timeout, this , [=] {
8383 setLabelVisible (false );
8484 });
8585 }
@@ -120,7 +120,7 @@ void Edge::hoverLeaveEvent(QGraphicsSceneHoverEvent * event)
120120
121121QPen Edge::buildPen (bool ignoreDashSetting) const
122122{
123- QPen pen { QBrush { QColor { m_color.red (), m_color.green (), m_color.blue () } }, m_width };
123+ QPen pen { QBrush { QColor { m_color.red (), m_color.green (), m_color.blue () } }, m_edgeWidth };
124124 pen.setCapStyle (Qt::PenCapStyle::RoundCap);
125125 if (!ignoreDashSetting && m_dashedLine) {
126126 pen.setDashPattern (Constants::Edge::DASH_PATTERN);
@@ -199,9 +199,9 @@ void Edge::setLabelVisible(bool visible, EdgeTextEdit::VisibilityChangeReason vc
199199 }
200200}
201201
202- void Edge::setWidth (double width )
202+ void Edge::setEdgeWidth (double edgeWidth )
203203{
204- m_width = width ;
204+ m_edgeWidth = edgeWidth ;
205205
206206 updateLine ();
207207}
@@ -216,6 +216,13 @@ void Edge::setArrowMode(ArrowMode arrowMode)
216216 }
217217}
218218
219+ void Edge::setArrowSize (double arrowSize)
220+ {
221+ m_arrowSize = arrowSize;
222+
223+ updateLine ();
224+ }
225+
219226void Edge::setColor (const QColor & color)
220227{
221228 m_color = color;
@@ -299,10 +306,10 @@ void Edge::updateArrowhead()
299306 case ArrowMode::Single: {
300307 lineL0.setP1 (point0);
301308 const auto angleL = qDegreesToRadians (angle0 + Constants::Edge::ARROW_OPENING);
302- lineL0.setP2 (point0 + QPointF (std::cos (angleL), std::sin (angleL)) * Constants::Edge::ARROW_LENGTH );
309+ lineL0.setP2 (point0 + QPointF (std::cos (angleL), std::sin (angleL)) * m_arrowSize );
303310 lineR0.setP1 (point0);
304311 const auto angleR = qDegreesToRadians (angle0 - Constants::Edge::ARROW_OPENING);
305- lineR0.setP2 (point0 + QPointF (std::cos (angleR), std::sin (angleR)) * Constants::Edge::ARROW_LENGTH );
312+ lineR0.setP2 (point0 + QPointF (std::cos (angleR), std::sin (angleR)) * m_arrowSize );
306313 m_arrowheadL0->setLine (lineL0);
307314 m_arrowheadR0->setLine (lineR0);
308315 m_arrowheadL0->show ();
@@ -314,20 +321,20 @@ void Edge::updateArrowhead()
314321 case ArrowMode::Double: {
315322 lineL0.setP1 (point0);
316323 const auto angleL0 = qDegreesToRadians (angle0 + Constants::Edge::ARROW_OPENING);
317- lineL0.setP2 (point0 + QPointF (std::cos (angleL0), std::sin (angleL0)) * Constants::Edge::ARROW_LENGTH );
324+ lineL0.setP2 (point0 + QPointF (std::cos (angleL0), std::sin (angleL0)) * m_arrowSize );
318325 lineR0.setP1 (point0);
319326 const auto angleR0 = qDegreesToRadians (angle0 - Constants::Edge::ARROW_OPENING);
320- lineR0.setP2 (point0 + QPointF (std::cos (angleR0), std::sin (angleR0)) * Constants::Edge::ARROW_LENGTH );
327+ lineR0.setP2 (point0 + QPointF (std::cos (angleR0), std::sin (angleR0)) * m_arrowSize );
321328 lineL1.setP1 (point1);
322329 m_arrowheadL0->setLine (lineL0);
323330 m_arrowheadR0->setLine (lineR0);
324331 m_arrowheadL0->show ();
325332 m_arrowheadR0->show ();
326333 const auto angleL1 = qDegreesToRadians (angle1 + Constants::Edge::ARROW_OPENING);
327- lineL1.setP2 (point1 + QPointF (std::cos (angleL1), std::sin (angleL1)) * Constants::Edge::ARROW_LENGTH );
334+ lineL1.setP2 (point1 + QPointF (std::cos (angleL1), std::sin (angleL1)) * m_arrowSize );
328335 lineR1.setP1 (point1);
329336 const auto angleR1 = qDegreesToRadians (angle1 - Constants::Edge::ARROW_OPENING);
330- lineR1.setP2 (point1 + QPointF (std::cos (angleR1), std::sin (angleR1)) * Constants::Edge::ARROW_LENGTH );
337+ lineR1.setP2 (point1 + QPointF (std::cos (angleR1), std::sin (angleR1)) * m_arrowSize );
331338 m_arrowheadL1->setLine (lineL1);
332339 m_arrowheadR1->setLine (lineR1);
333340 m_arrowheadL1->show ();
@@ -424,7 +431,7 @@ void Edge::updateLine()
424431 setLine (QLineF (
425432 p1 + (nearestPoints.first .isCorner ? Constants::Edge::CORNER_RADIUS_SCALE * (direction1 * static_cast <float >(sourceNode ().cornerRadius ())).toPointF () : QPointF { 0 , 0 }),
426433 p2 + (nearestPoints.second .isCorner ? Constants::Edge::CORNER_RADIUS_SCALE * (direction2 * static_cast <float >(targetNode ().cornerRadius ())).toPointF () : QPointF { 0 , 0 }) - //
427- (direction2 * static_cast <float >(m_width )).toPointF () * Constants::Edge::WIDTH_SCALE));
434+ (direction2 * static_cast <float >(m_edgeWidth )).toPointF () * Constants::Edge::WIDTH_SCALE));
428435
429436 updateDots ();
430437 updateLabel (LabelUpdateReason::EdgeGeometryChanged);
0 commit comments