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)
{
bool flag = true;
if (nameActivDraw == newName)
{
currentColor = Qt::black;
firstArc->setFlag(QGraphicsItem::ItemIsSelectable, true);
firstArc->setAcceptHoverEvents(true);
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, true);
secondArc->setAcceptHoverEvents(true);
flag = true;
}
else
{
currentColor = Qt::gray;
firstArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
firstArc->setAcceptHoverEvents(false);
secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false);
secondArc->setAcceptHoverEvents(false);
flag = false;
}
firstArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
secondArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
firstArc->ChangedActivDraw(flag);
secondArc->ChangedActivDraw(flag);
VToolPoint::ChangedActivDraw(newName);
}

View file

@ -54,6 +54,14 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor,
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.

View file

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