Refactoring.

--HG--
branch : feature
This commit is contained in:
dismine 2014-03-06 15:35:14 +02:00
parent eba24ec34b
commit ab19b30713
2 changed files with 18 additions and 16 deletions

View File

@ -178,23 +178,24 @@ void VToolCutSpline::SplineChoosed(quint32 id)
void VToolCutSpline::ChangedActivDraw(const QString &newName) void VToolCutSpline::ChangedActivDraw(const QString &newName)
{ {
bool flag = true;
if (nameActivDraw == newName) if (nameActivDraw == newName)
{ {
currentColor = Qt::black; currentColor = Qt::black;
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); flag = true;
firstSpline->setAcceptHoverEvents(true);
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
secondSpline->setAcceptHoverEvents(true);
} }
else else
{ {
currentColor = Qt::gray; currentColor = Qt::gray;
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); flag = false;
firstSpline->setAcceptHoverEvents(false);
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
secondSpline->setAcceptHoverEvents(false);
} }
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag);
firstSpline->setAcceptHoverEvents(flag);
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag);
secondSpline->setAcceptHoverEvents(flag);
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }

View File

@ -259,23 +259,24 @@ void VToolCutSplinePath::SplineChoosed(quint32 id)
void VToolCutSplinePath::ChangedActivDraw(const QString &newName) void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
{ {
bool flag = true;
if (nameActivDraw == newName) if (nameActivDraw == newName)
{ {
currentColor = Qt::black; currentColor = Qt::black;
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); flag = true;
firstSpline->setAcceptHoverEvents(true);
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true);
secondSpline->setAcceptHoverEvents(true);
} }
else else
{ {
currentColor = Qt::gray; currentColor = Qt::gray;
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); flag = false;
firstSpline->setAcceptHoverEvents(false);
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false);
secondSpline->setAcceptHoverEvents(false);
} }
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag);
firstSpline->setAcceptHoverEvents(flag);
firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag);
secondSpline->setAcceptHoverEvents(flag);
secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }