We don't need to change pen inside RefreshLine method

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-12-11 13:35:48 +02:00
parent 0869c7fed4
commit a1417fc127
4 changed files with 5 additions and 8 deletions

View File

@ -247,10 +247,8 @@ void VToolSinglePoint::RefreshPointGeometry(const VPointF &point)
void VToolSinglePoint::RefreshLine(quint32 id) void VToolSinglePoint::RefreshLine(quint32 id)
{ {
Q_UNUSED(id) Q_UNUSED(id)
QPen pen(CorrectColor(Qt::black)); VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
pen.setWidthF(qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor); lineName->setPen(QPen(CorrectColor(Qt::black), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
VAbstractTool::RefreshLine(this, namePoint, lineName, radius, pen);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -279,5 +279,5 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
*/ */
void VNodePoint::RefreshLine() void VNodePoint::RefreshLine()
{ {
VAbstractTool::RefreshLine(this, namePoint, lineName, radius, QPen(Qt::black)); VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
} }

View File

@ -321,7 +321,7 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractP
* @brief RefreshLine refresh line to label on scene. * @brief RefreshLine refresh line to label on scene.
*/ */
void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName, void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName,
const qreal radius, const QPen pen) const qreal radius)
{ {
QRectF nRec = namePoint->sceneBoundingRect(); QRectF nRec = namePoint->sceneBoundingRect();
nRec.translate(- point->scenePos()); nRec.translate(- point->scenePos());
@ -332,7 +332,6 @@ void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleText
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - point->scenePos()), p1, p2); VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - point->scenePos()), p1, p2);
const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(point->scenePos(), nameRec.center())); const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(point->scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - point->scenePos())); lineName->setLine(QLineF(p1, pRec - point->scenePos()));
lineName->setPen(pen);
if (QLineF(p1, pRec - point->scenePos()).length() <= ToPixel(4, Unit::Mm)) if (QLineF(p1, pRec - point->scenePos()).length() <= ToPixel(4, Unit::Mm))
{ {

View File

@ -124,7 +124,7 @@ protected:
void ToolCreation(const Source &typeCreation); void ToolCreation(const Source &typeCreation);
static void RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName, static void RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName,
const qreal radius, const QPen pen); const qreal radius);
private: private:
Q_DISABLE_COPY(VAbstractTool) Q_DISABLE_COPY(VAbstractTool)
}; };