Allow setting destination point.

Destination point is anchor to which connected a label.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-05-11 18:37:08 +03:00
parent 6ecfa80e6f
commit d07c27a96c
2 changed files with 10 additions and 1 deletions

View File

@ -164,7 +164,7 @@ void VGraphicsSimpleTextItem::CorrectLabelPosition()
if (scale > 1)
{
QLineF line(QPointF(), m_realPos);
QLineF line(m_destination, m_realPos);
line.setLength(line.length() / scale);
newPos = line.p2();
}
@ -364,6 +364,12 @@ void VGraphicsSimpleTextItem::keyReleaseEvent(QKeyEvent *event)
QGraphicsSimpleTextItem::keyReleaseEvent ( event );
}
//---------------------------------------------------------------------------------------------------------------------
void VGraphicsSimpleTextItem::SetDestination(const QPointF &destination)
{
m_destination = destination;
}
//---------------------------------------------------------------------------------------------------------------------
QColor VGraphicsSimpleTextItem::BaseColor() const
{

View File

@ -68,6 +68,8 @@ public:
QColor BaseColor() const;
void SetBaseColor(const QColor &baseColor);
void SetDestination(const QPointF &destination);
signals:
/**
* @brief NameChangePosition emit when label change position.
@ -96,6 +98,7 @@ private:
bool m_showParentTooltip;
QPointF m_realPos{};
QColor m_baseColor{Qt::black};
QPointF m_destination{};
void Init();