[TD]fix over/under tolerance

- left justify tolerances
- use format spec for tolerance == zero
- prevent uncommanded tolerance format changes
- use 'w' format for HoleShaftFit
- allow zero tolerance values for HoleShaftFit
This commit is contained in:
wandererfan
2024-03-14 14:22:29 -04:00
committed by WandererFan
parent a63ed712f6
commit fca3b80da8
4 changed files with 15 additions and 37 deletions

View File

@@ -275,20 +275,13 @@ void QGIDatumLabel::setPosFromCenter(const double& xCenter, const double& yCente
//set tolerance position
QRectF overBox = m_tolTextOver->boundingRect();
double overWidth = overBox.width();
QRectF underBox = m_tolTextUnder->boundingRect();
double underWidth = underBox.width();
double width = underWidth;
if (overWidth > underWidth) {
width = overWidth;
}
double tolRight = unitRight + width;
double tolLeft = unitRight;
// Adjust for difference in tight and original bounding box sizes, note the y-coord down system
QPointF tol_adj = m_tolTextOver->tightBoundingAdjust();
m_tolTextOver->justifyRightAt(tolRight + tol_adj.x(), middle - tol_adj.y(), false);
m_tolTextOver->justifyLeftAt(tolLeft + tol_adj.x(), middle - tol_adj.y(), false);
tol_adj = m_tolTextUnder->tightBoundingAdjust();
m_tolTextUnder->justifyRightAt(tolRight + tol_adj.x(), middle + overBox.height() - tol_adj.y(),
m_tolTextUnder->justifyLeftAt(tolLeft + tol_adj.x(), middle + overBox.height() - tol_adj.y(),
false);
}