Merge
--HG-- branch : develop
This commit is contained in:
commit
f600a00db8
|
@ -247,32 +247,8 @@ void VToolSinglePoint::RefreshPointGeometry(const VPointF &point)
|
|||
void VToolSinglePoint::RefreshLine(quint32 id)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
|
||||
QRectF nRec = namePoint->sceneBoundingRect();
|
||||
nRec.translate(- scenePos());
|
||||
if (this->rect().intersects(nRec) == false)
|
||||
{
|
||||
const QRectF nameRec = namePoint->sceneBoundingRect();
|
||||
QPointF p1, p2;
|
||||
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2);
|
||||
const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||
lineName->setPen(QPen(CorrectColor(Qt::black),
|
||||
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||
|
||||
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setVisible(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
}
|
||||
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
||||
lineName->setPen(QPen(CorrectColor(Qt::black), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -279,17 +279,5 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
|
|||
*/
|
||||
void VNodePoint::RefreshLine()
|
||||
{
|
||||
QRectF nameRec = namePoint->sceneBoundingRect();
|
||||
QPointF p1, p2;
|
||||
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
|
||||
QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
|
||||
lineName->setLine(QLineF(p1, pRec - scenePos()));
|
||||
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setVisible(true);
|
||||
}
|
||||
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "../../vmisc/vsettings.h"
|
||||
#include "../undocommands/deltool.h"
|
||||
#include "../undocommands/savetooloptions.h"
|
||||
#include "../vwidgets/vgraphicssimpletextitem.h"
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QIcon>
|
||||
|
@ -315,3 +316,39 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractP
|
|||
history->insert(index+1, record);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshLine refresh line to label on scene.
|
||||
*/
|
||||
void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName,
|
||||
const qreal radius)
|
||||
{
|
||||
SCASSERT(point != nullptr);
|
||||
SCASSERT(namePoint != nullptr);
|
||||
SCASSERT(lineName != nullptr);
|
||||
|
||||
QRectF nRec = namePoint->sceneBoundingRect();
|
||||
nRec.translate(- point->scenePos());
|
||||
if (point->rect().intersects(nRec) == false)
|
||||
{
|
||||
const QRectF nameRec = namePoint->sceneBoundingRect();
|
||||
QPointF 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()));
|
||||
lineName->setLine(QLineF(p1, pRec - point->scenePos()));
|
||||
|
||||
if (QLineF(p1, pRec - point->scenePos()).length() <= ToPixel(4, Unit::Mm))
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setVisible(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lineName->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ class QGraphicsView;
|
|||
class QGraphicsItem;
|
||||
class QRectF;
|
||||
class Visualization;
|
||||
class VGraphicsSimpleTextItem;
|
||||
|
||||
/**
|
||||
* @brief The VAbstractTool abstract class for all tools.
|
||||
|
@ -121,6 +122,9 @@ protected:
|
|||
|
||||
virtual void SetVisualization()=0;
|
||||
void ToolCreation(const Source &typeCreation);
|
||||
|
||||
static void RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName,
|
||||
const qreal radius);
|
||||
private:
|
||||
Q_DISABLE_COPY(VAbstractTool)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user