If point intersects with rect the line to the label wrong.

--HG--
branch : develop
This commit is contained in:
dismine 2014-08-17 22:34:01 +03:00
parent fcffc03649
commit aec154e43c

View File

@ -240,6 +240,10 @@ void VToolPoint::RefreshPointGeometry(const VPointF &point)
* @brief RefreshLine refresh line to label on scene. * @brief RefreshLine refresh line to label on scene.
*/ */
void VToolPoint::RefreshLine() void VToolPoint::RefreshLine()
{
QRectF nRec = namePoint->sceneBoundingRect();
nRec.translate(- scenePos());
if (this->rect().intersects(nRec) == false)
{ {
QRectF nameRec = namePoint->sceneBoundingRect(); QRectF nameRec = namePoint->sceneBoundingRect();
QPointF p1, p2; QPointF p1, p2;
@ -254,6 +258,7 @@ void VToolPoint::RefreshLine()
{ {
lineName->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor)); lineName->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor));
} }
if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm)) if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4, Unit::Mm))
{ {
lineName->setVisible(false); lineName->setVisible(false);
@ -263,6 +268,11 @@ void VToolPoint::RefreshLine()
lineName->setVisible(true); lineName->setVisible(true);
} }
} }
else
{
lineName->setVisible(false);
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**