Correct label size according to parent's bounding rect.
--HG-- branch : feature
This commit is contained in:
parent
cda54a62ec
commit
d45a04feb0
|
@ -433,7 +433,7 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
qreal dX;
|
qreal dX;
|
||||||
qreal dY;
|
qreal dY;
|
||||||
QRectF rectBB;
|
QRectF rectBB;
|
||||||
QPointF ptDiff = pME->scenePos() - m_ptStart;
|
const QPointF ptDiff = pME->scenePos() - m_ptStart;
|
||||||
if (m_eMode == mMove)
|
if (m_eMode == mMove)
|
||||||
{
|
{
|
||||||
// in move mode move the label along the mouse move from the origin
|
// in move mode move the label along the mouse move from the origin
|
||||||
|
@ -458,13 +458,15 @@ void VTextGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* pME)
|
||||||
QSizeF sz(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
|
QSizeF sz(m_szStart.width() + ptDiff.x(), m_szStart.height() + ptDiff.y());
|
||||||
rectBB.setSize(sz);
|
rectBB.setSize(sz);
|
||||||
// before resizing the label to a new size, check if it will still be inside the parent item
|
// before resizing the label to a new size, check if it will still be inside the parent item
|
||||||
if (IsContained(rectBB, rotation(), dX, dY) == true)
|
if (IsContained(rectBB, rotation(), dX, dY) == false)
|
||||||
{
|
{
|
||||||
|
sz = QSizeF(sz.width()+dX, sz.height()+dY);
|
||||||
|
}
|
||||||
|
|
||||||
SetSize(sz.width(), sz.height());
|
SetSize(sz.width(), sz.height());
|
||||||
Update();
|
Update();
|
||||||
emit SignalShrink();
|
emit SignalShrink();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (m_eMode == mRotate)
|
else if (m_eMode == mRotate)
|
||||||
{
|
{
|
||||||
// if the angle from the original position is small (0.5 degrees), just remeber the new angle
|
// if the angle from the original position is small (0.5 degrees), just remeber the new angle
|
||||||
|
|
Loading…
Reference in New Issue
Block a user