Refactoring.

--HG--
branch : develop
This commit is contained in:
dismine 2014-06-25 16:32:31 +03:00
parent 390e48cddb
commit 129e579612
3 changed files with 14 additions and 10 deletions

View File

@ -230,24 +230,19 @@ void VToolCutArc::ArcChoosed(quint32 id)
*/ */
void VToolCutArc::ChangedActivDraw(const QString &newName) void VToolCutArc::ChangedActivDraw(const QString &newName)
{ {
bool flag = true;
if (nameActivDraw == newName) if (nameActivDraw == newName)
{ {
currentColor = Qt::black; currentColor = Qt::black;
firstArc->setFlag(QGraphicsItem::ItemIsSelectable, true); flag = true;
firstArc->setAcceptHoverEvents(true);
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, true);
secondArc->setAcceptHoverEvents(true);
} }
else else
{ {
currentColor = Qt::gray; currentColor = Qt::gray;
firstArc->setFlag(QGraphicsItem::ItemIsSelectable, false); flag = false;
firstArc->setAcceptHoverEvents(false);
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
secondArc->setAcceptHoverEvents(false);
} }
firstArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); firstArc->ChangedActivDraw(flag);
secondArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); secondArc->ChangedActivDraw(flag);
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
} }

View File

@ -54,6 +54,14 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor,
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
} }
//---------------------------------------------------------------------------------------------------------------------
void VSimpleArc::ChangedActivDraw(const bool &flag)
{
setFlag(QGraphicsItem::ItemIsSelectable, flag);
setAcceptHoverEvents(flag);
setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief mouseReleaseEvent handle mouse release events. * @brief mouseReleaseEvent handle mouse release events.

View File

@ -41,6 +41,7 @@ class VSimpleArc : public QObject, public QGraphicsPathItem
Q_OBJECT Q_OBJECT
public: public:
VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr); VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr);
void ChangedActivDraw(const bool &flag);
signals: signals:
/** /**
* @brief Choosed send id when clicked. * @brief Choosed send id when clicked.