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; currentColor = Qt::gray;
flag = false; flag = false;
} }
firstSpline->ChangedActivDraw(flag);
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); secondSpline->ChangedActivDraw(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));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }

View file

@ -261,14 +261,8 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName)
currentColor = Qt::gray; currentColor = Qt::gray;
flag = false; flag = false;
} }
firstSpline->ChangedActivDraw(flag);
firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); secondSpline->ChangedActivDraw(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));
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }

View file

@ -44,6 +44,13 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f
setAcceptHoverEvents(true); 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) void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)

View file

@ -56,6 +56,7 @@ public:
* @param parent parent object. * @param parent parent object.
*/ */
VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0); VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0);
void ChangedActivDraw(const bool &flag);
signals: signals:
/** /**
* @brief Choosed send id when clicked. * @brief Choosed send id when clicked.