Allow setting destination point.
Destination point is anchor to which connected a label. --HG-- branch : develop
This commit is contained in:
parent
6ecfa80e6f
commit
d07c27a96c
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user