diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 0e83bdfac..ee7608e94 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -189,14 +189,8 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName) currentColor = Qt::gray; flag = false; } - - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - firstSpline->setAcceptHoverEvents(flag); - firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - secondSpline->setAcceptHoverEvents(flag); - secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + firstSpline->ChangedActivDraw(flag); + secondSpline->ChangedActivDraw(flag); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index d8f8a66cc..ab4d1159f 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -261,14 +261,8 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName) currentColor = Qt::gray; flag = false; } - - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - firstSpline->setAcceptHoverEvents(flag); - firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - secondSpline->setAcceptHoverEvents(flag); - secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + firstSpline->ChangedActivDraw(flag); + secondSpline->ChangedActivDraw(flag); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index 70d5c2c3f..c70488228 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -44,6 +44,13 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f setAcceptHoverEvents(true); } +void VSimpleSpline::ChangedActivDraw(const bool &flag) +{ + setFlag(QGraphicsItem::ItemIsSelectable, flag); + setAcceptHoverEvents(flag); + setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); +} + void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/widgets/vsimplespline.h b/src/widgets/vsimplespline.h index 51045182e..05f2bc816 100644 --- a/src/widgets/vsimplespline.h +++ b/src/widgets/vsimplespline.h @@ -56,6 +56,7 @@ public: * @param parent parent object. */ VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0); + void ChangedActivDraw(const bool &flag); signals: /** * @brief Choosed send id when clicked.