[TD] Make dimension number graphical layout more compact by making boundingRect() tighter for dimension number labels.

This commit is contained in:
Aapo
2020-11-26 14:07:38 +02:00
committed by wwmayer
parent a8728853d9
commit f2e91ec488
3 changed files with 44 additions and 3 deletions

View File

@@ -107,12 +107,16 @@ QGIDatumLabel::QGIDatumLabel()
setFiltersChildEvents(true);
m_dimText = new QGCustomText();
m_dimText->setTightBounding(true);
m_dimText->setParentItem(this);
m_tolTextOver = new QGCustomText();
m_tolTextOver->setTightBounding(true);
m_tolTextOver->setParentItem(this);
m_tolTextUnder = new QGCustomText();
m_tolTextUnder->setTightBounding(true);
m_tolTextUnder->setParentItem(this);
m_unitText = new QGCustomText();
m_unitText->setTightBounding(true);
m_unitText->setParentItem(this);
m_ctrl = false;
@@ -266,8 +270,8 @@ void QGIDatumLabel::setPosFromCenter(const double &xCenter, const double &yCente
}
double tolRight = unitRight + width;
m_tolTextOver->justifyRightAt(tolRight, middle, false);
m_tolTextUnder->justifyRightAt(tolRight, middle + underBox.height(), false);
m_tolTextOver->justifyRightAt(tolRight, middle - overBox.height() + underBox.height()/4, false);
m_tolTextUnder->justifyRightAt(tolRight, middle + underBox.height()/4, false);
}