Use method setEnabled instead direct change Pen where possible.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-02-04 15:09:37 +02:00
parent 06d415f320
commit 8b7567c32a
5 changed files with 2 additions and 25 deletions

View File

@ -239,7 +239,6 @@ void VToolLine::ChangedActivDraw(const QString &newName)
{ {
VDrawTool::ChangedActivDraw(newName); VDrawTool::ChangedActivDraw(newName);
this->setEnabled(nameActivDraw == newName); this->setEnabled(nameActivDraw == newName);
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine)));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -71,7 +71,7 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName)
{ {
VToolPoint::ChangedActivDraw(newName); VToolPoint::ChangedActivDraw(newName);
this->setEnabled(nameActivDraw == newName); this->setEnabled(nameActivDraw == newName);
mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyleToPenStyle(typeLine))); mainLine->setEnabled(nameActivDraw == newName);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -299,26 +299,6 @@ void VToolSinglePoint::FullUpdateFromFile()
RefreshPointGeometry(point); RefreshPointGeometry(point);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChangedActivDraw disable or enable context menu after change active pattern peace.
* @param newName new name active pattern peace.
*/
void VToolSinglePoint::ChangedActivDraw(const QString &newName)
{
VToolPoint::ChangedActivDraw(newName);
if (nameActivDraw == newName)
{
this->setEnabled(true);
SetColorLabel(Qt::black);
}
else
{
this->setEnabled(false);
SetColorLabel(Qt::gray);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief SetFactor set current scale factor of scene. * @brief SetFactor set current scale factor of scene.

View File

@ -48,7 +48,6 @@ public:
virtual void ShowVisualization(bool show); virtual void ShowVisualization(bool show);
public slots: public slots:
virtual void FullUpdateFromFile(); virtual void FullUpdateFromFile();
virtual void ChangedActivDraw(const QString &newName);
virtual void SetFactor(qreal factor); virtual void SetFactor(qreal factor);
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event); virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
signals: signals:

View File

@ -60,8 +60,7 @@ VSimpleCurve::VSimpleCurve(quint32 id, Qt::GlobalColor *currentColor, SimpleCurv
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VSimpleCurve::ChangedActivDraw(const bool &flag) void VSimpleCurve::ChangedActivDraw(const bool &flag)
{ {
setFlag(QGraphicsItem::ItemIsSelectable, flag); setEnabled(flag);
setAcceptHoverEvents(flag);
setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor));
} }