diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 5078c52d43..394c8d3659 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -923,17 +923,21 @@ std::string DrawViewDimension::getFormattedDimensionValue(int partial) { QString qFormatSpec = QString::fromUtf8(FormatSpec.getStrValue().data()); - if (Arbitrary.getValue()) { + if (Arbitrary.getValue() && !EqualTolerance.getValue()) { return FormatSpec.getStrValue(); } // if there is an equal over-/undertolerance and not theoretically exact, add the tolerance to dimension - if (EqualTolerance.getValue() && !DrawUtil::fpCompare(OverTolerance.getValue(), 0.0) - && !TheoreticalExact.getValue()) { + if (EqualTolerance.getValue() && !TheoreticalExact.getValue() && + (!DrawUtil::fpCompare(OverTolerance.getValue(), 0.0) || ArbitraryTolerances.getValue())) { QString labelText = QString::fromUtf8(formatValue(getDimValue(), qFormatSpec, 1).c_str()); //just the number pref/spec/suf QString unitText = QString::fromUtf8(formatValue(getDimValue(), qFormatSpec, 2).c_str()); //just the unit QString tolerance = QString::fromStdString(getFormattedToleranceValue(1).c_str()); QString result; + if (Arbitrary.getValue()) { + labelText = QString::fromStdString(FormatSpec.getStrValue()); + unitText = QString(); + } // tolerance might start with a plus sign that we don't want, so cut it off if (tolerance.at(0) == QChar::fromLatin1('+')) tolerance.remove(0, 1); diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 56068b52c4..e8cbf9204b 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -337,14 +337,10 @@ void QGIDatumLabel::setToleranceString() if( dim == nullptr ) { return; // don't show if both are zero or if EqualTolerance is true - } else if (!dim->hasOverUnderTolerance() || dim->EqualTolerance.getValue()) { + } else if (!dim->hasOverUnderTolerance() || dim->EqualTolerance.getValue() || dim->TheoreticalExact.getValue()) { m_tolTextOver->hide(); m_tolTextUnder->hide(); - return; - } else if (dim->TheoreticalExact.getValue()) { - m_tolTextOver->hide(); - m_tolTextUnder->hide(); - // we must explicitly empy the text other wise the frame drawn for + // we must explicitly empty the text otherwise the frame drawn for // TheoreticalExact would be as wide as necessary for the text m_tolTextOver->setPlainText(QString()); m_tolTextUnder->setPlainText(QString()); @@ -353,11 +349,6 @@ void QGIDatumLabel::setToleranceString() m_tolTextOver->show(); m_tolTextUnder->show(); - QString tolSuffix; - if ((dim->Type.isValue("Angle")) || (dim->Type.isValue("Angle3Pt"))) { - tolSuffix = QString::fromUtf8(dim->getFormattedDimensionValue(2).c_str()); //just the unit - } - std::pair labelTexts, unitTexts; if (dim->ArbitraryTolerances.getValue()) { @@ -637,14 +628,22 @@ void QGIViewDimension::updateDim() QString labelText; QString unitText; - if (dim->Arbitrary.getValue()) { + if (dim->Arbitrary.getValue() && !dim->EqualTolerance.getValue()) { labelText = QString::fromUtf8(dim->getFormattedDimensionValue(1).c_str()); //just the number pref/spec/suf } else { if (dim->isMultiValueSchema()) { labelText = QString::fromUtf8(dim->getFormattedDimensionValue(0).c_str()); //don't format multis } else { labelText = QString::fromUtf8(dim->getFormattedDimensionValue(1).c_str()); //just the number pref/spec/suf - unitText = QString::fromUtf8(dim->getFormattedDimensionValue(2).c_str()); //just the unit + if (dim->EqualTolerance.getValue()) { + if (dim->ArbitraryTolerances.getValue()) { + unitText = QString(); + } else { + unitText = QString::fromUtf8(dim->getFormattedToleranceValue(2).c_str()); //just the unit + } + } else { + unitText = QString::fromUtf8(dim->getFormattedDimensionValue(2).c_str()); //just the unit + } } } QFont font = datumLabel->getFont();