Refactoring.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-06 16:09:22 +02:00
parent 2fc4d95faa
commit dd78969c9c
4 changed files with 12 additions and 16 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)

View File

@ -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.