diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index f4c72d183..0259e6a77 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -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 { diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.h b/src/libs/vwidgets/vgraphicssimpletextitem.h index a072e8836..3ba9075b9 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.h +++ b/src/libs/vwidgets/vgraphicssimpletextitem.h @@ -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();