From 593867f4fe62b475c7b386261f6fc4a82697f2d4 Mon Sep 17 00:00:00 2001 From: Dmitry Pinaev Date: Fri, 16 Aug 2024 22:04:36 +0200 Subject: [PATCH] Update DefaultConnectionPainter.cpp --- src/DefaultConnectionPainter.cpp | 65 +++++++++++++++----------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/src/DefaultConnectionPainter.cpp b/src/DefaultConnectionPainter.cpp index 9c2ca4af..856d3085 100644 --- a/src/DefaultConnectionPainter.cpp +++ b/src/DefaultConnectionPainter.cpp @@ -26,40 +26,6 @@ QPainterPath DefaultConnectionPainter::cubicPath(ConnectionGraphicsObject const return cubic; } - - -#ifdef NODE_DEBUG_DRAWING -void DefaultConnectionPainter::debugDrawing(QPainter *painter, ConnectionGraphicsObject const &cgo) -{ - Q_UNUSED(painter); - - { - QPointF const &in = cgo.endPoint(PortType::In); - QPointF const &out = cgo.endPoint(PortType::Out); - - auto const points = cgo.pointsC1C2(); - - painter->setPen(Qt::red); - painter->setBrush(Qt::red); - - painter->drawLine(QLineF(out, points.first)); - painter->drawLine(QLineF(points.first, points.second)); - painter->drawLine(QLineF(points.second, in)); - painter->drawEllipse(points.first, 3, 3); - painter->drawEllipse(points.second, 3, 3); - - painter->setBrush(Qt::NoBrush); - painter->drawPath(cubicPath(cgo)); - } - - { - painter->setPen(Qt::yellow); - painter->drawRect(cgo.boundingRect()); - } -} - -#endif - void DefaultConnectionPainter::drawSketchLine(QPainter *painter, ConnectionGraphicsObject const &cgo) { ConnectionState const &state = cgo.connectionState(); @@ -253,4 +219,35 @@ QPainterPath DefaultConnectionPainter::getPainterStroke(ConnectionGraphicsObject return stroker.createStroke(result); } +#ifdef NODE_DEBUG_DRAWING +void DefaultConnectionPainter::debugDrawing(QPainter *painter, ConnectionGraphicsObject const &cgo) +{ + Q_UNUSED(painter); + + { + QPointF const &in = cgo.endPoint(PortType::In); + QPointF const &out = cgo.endPoint(PortType::Out); + + auto const points = cgo.pointsC1C2(); + + painter->setPen(Qt::red); + painter->setBrush(Qt::red); + + painter->drawLine(QLineF(out, points.first)); + painter->drawLine(QLineF(points.first, points.second)); + painter->drawLine(QLineF(points.second, in)); + painter->drawEllipse(points.first, 3, 3); + painter->drawEllipse(points.second, 3, 3); + + painter->setBrush(Qt::NoBrush); + painter->drawPath(cubicPath(cgo)); + } + + { + painter->setPen(Qt::yellow); + painter->drawRect(cgo.boundingRect()); + } +} +#endif + } // namespace QtNodes