Made sure that labels stay inside the detail after changing size or height
--HG-- branch : feature
This commit is contained in:
parent
a5f16ab738
commit
92ec78e6b3
|
@ -2805,6 +2805,7 @@ void MainWindow::ChangedSize(const QString & text)
|
|||
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), text.toInt(), static_cast<int>(pattern->height())))
|
||||
{
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
emit sceneDetails->DimensionsChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2833,6 +2834,7 @@ void MainWindow::ChangedHeight(const QString &text)
|
|||
if (UpdateMeasurements(AbsoluteMPath(curFile, doc->MPath()), static_cast<int>(pattern->size()), text.toInt()))
|
||||
{
|
||||
doc->LiteParseTree(Document::LiteParse);
|
||||
emit sceneDetails->DimensionsChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -230,6 +230,23 @@ void VTextGraphicsItem::SetSize(qreal fW, qreal fH)
|
|||
return;
|
||||
}
|
||||
|
||||
if (fW > parentItem()->boundingRect().width())
|
||||
{
|
||||
fW = parentItem()->boundingRect().width();
|
||||
}
|
||||
if (fW < MIN_W)
|
||||
{
|
||||
fW = MIN_W;
|
||||
}
|
||||
if (fH > parentItem()->boundingRect().height())
|
||||
{
|
||||
fH = parentItem()->boundingRect().height();
|
||||
}
|
||||
if (fH < m_iMinH)
|
||||
{
|
||||
fH = m_iMinH;
|
||||
}
|
||||
|
||||
m_rectBoundingBox.setTopLeft(QPointF(0, 0));
|
||||
m_rectBoundingBox.setWidth(fW);
|
||||
m_rectBoundingBox.setHeight(fH);
|
||||
|
|
|
@ -206,6 +206,10 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32
|
|||
connect(doc, &VAbstractPattern::patternChanged, this, &VToolDetail::UpdatePatternInfo);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdateLabel);
|
||||
connect(doc, &VAbstractPattern::CheckLayout, this, &VToolDetail::UpdatePatternInfo);
|
||||
|
||||
connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdateLabel);
|
||||
connect(sceneDetails, &VMainGraphicsScene::DimensionsChanged, this, &VToolDetail::UpdatePatternInfo);
|
||||
|
||||
UpdateLabel();
|
||||
UpdatePatternInfo();
|
||||
}
|
||||
|
@ -770,8 +774,8 @@ void VToolDetail::UpdateLabel()
|
|||
QPointF pt = data.GetPos();
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setWidth(data.GetLabelWidth());
|
||||
rectBB.setHeight(data.GetLabelHeight());
|
||||
rectBB.setWidth(dataLabel->boundingRect().width());
|
||||
rectBB.setHeight(dataLabel->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (dataLabel->IsContained(rectBB, data.GetRotation(), dX, dY) == false)
|
||||
|
@ -816,8 +820,8 @@ void VToolDetail::UpdatePatternInfo()
|
|||
QPointF pt = geom.GetPos();
|
||||
QRectF rectBB;
|
||||
rectBB.setTopLeft(pt);
|
||||
rectBB.setWidth(geom.GetLabelWidth());
|
||||
rectBB.setHeight(geom.GetLabelHeight());
|
||||
rectBB.setWidth(patternInfo->boundingRect().width());
|
||||
rectBB.setHeight(patternInfo->boundingRect().height());
|
||||
qreal dX;
|
||||
qreal dY;
|
||||
if (patternInfo->IsContained(rectBB, geom.GetRotation(), dX, dY) == false)
|
||||
|
|
|
@ -146,6 +146,8 @@ signals:
|
|||
void EnableNodePointItemHover(bool enabled);
|
||||
void EnableDetailItemHover(bool enabled);
|
||||
void EnableLineItemHover(bool enabled);
|
||||
void DimensionsChanged();
|
||||
|
||||
private:
|
||||
/** @brief horScrollBar value horizontal scroll bar. */
|
||||
qint32 horScrollBar;
|
||||
|
|
Loading…
Reference in New Issue
Block a user