From 037e91484ae576d747b93ebce47a1fa9458a6ceb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 17 Mar 2016 16:26:25 +0200 Subject: [PATCH] For tool Cubic Bezier curve show connection to control points. --HG-- branch : feature --- .../vtools/visualization/vistoolcubicbezier.cpp | 14 ++++++++------ src/libs/vtools/visualization/vistoolcubicbezier.h | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libs/vtools/visualization/vistoolcubicbezier.cpp b/src/libs/vtools/visualization/vistoolcubicbezier.cpp index 6234c6913..c6d3af4ca 100644 --- a/src/libs/vtools/visualization/vistoolcubicbezier.cpp +++ b/src/libs/vtools/visualization/vistoolcubicbezier.cpp @@ -39,14 +39,16 @@ VisToolCubicBezier::VisToolCubicBezier(const VContainer *data, QGraphicsItem *pa point2(nullptr), point3(nullptr), point4(nullptr), - helpLine(nullptr) + helpLine1(nullptr), + helpLine2(nullptr) { + helpLine1 = InitItem(mainColor, this); + helpLine2 = InitItem(mainColor, this); + point1 = InitPoint(supportColor, this); point2 = InitPoint(supportColor, this); //-V656 point3 = InitPoint(supportColor, this); //-V656 point4 = InitPoint(supportColor, this); //-V656 - - helpLine = InitItem(mainColor, this); } //--------------------------------------------------------------------------------------------------------------------- @@ -65,14 +67,13 @@ void VisToolCubicBezier::RefreshGeometry() if (object2Id <= NULL_ID) { const QLineF line = QLineF(first->toQPointF(), Visualization::scenePos); - DrawLine(helpLine, line, mainColor, lineStyle); + DrawLine(helpLine1, line, mainColor, Qt::DashLine); } else { - helpLine->setVisible(false); - const auto second = Visualization::data->GeometricObject(object2Id); DrawPoint(point2, second->toQPointF(), supportColor); + DrawLine(helpLine1, QLineF(first->toQPointF(), second->toQPointF()), mainColor, Qt::DashLine); if (object3Id <= NULL_ID) { @@ -94,6 +95,7 @@ void VisToolCubicBezier::RefreshGeometry() { const auto fourth = Visualization::data->GeometricObject(object4Id); DrawPoint(point4, fourth->toQPointF(), supportColor); + DrawLine(helpLine2, QLineF(fourth->toQPointF(), third->toQPointF()), mainColor, Qt::DashLine); VCubicBezier spline(*first, *second, *third, *fourth); DrawPath(this, spline.GetPath(PathDirection::Show), mainColor, Qt::SolidLine, Qt::RoundCap); diff --git a/src/libs/vtools/visualization/vistoolcubicbezier.h b/src/libs/vtools/visualization/vistoolcubicbezier.h index d67fcfdf7..2fc6d5fd9 100644 --- a/src/libs/vtools/visualization/vistoolcubicbezier.h +++ b/src/libs/vtools/visualization/vistoolcubicbezier.h @@ -56,7 +56,8 @@ protected: QGraphicsEllipseItem *point2; QGraphicsEllipseItem *point3; QGraphicsEllipseItem *point4; - QGraphicsLineItem *helpLine; + QGraphicsLineItem *helpLine1; + QGraphicsLineItem *helpLine2; }; #endif // VISTOOLCUBICBEZIER_H