diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index ef1dea950b..8849cedead 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -691,21 +691,12 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int // - the value in the base unit but without displayed unit // - the value + unit (not necessarily the base unit!) // the user can overwrite the decimal settings, so we must in every case use the formatSpecifier - // if useDecimals(), then formatSpecifier = global decimals, otherwise it is %.2f + // the default is: if useDecimals(), then formatSpecifier = global decimals, otherwise it is %.2f QLocale loc; double userVal; - bool checkDecimals = true; if (showUnits() || (Type.isValue("Angle")) || (Type.isValue("Angle3Pt"))) { - formattedValue = qUserString; // result value + unit (not necessarily base unit!) - // remove unit - formattedValue.remove(rxUnits); - // to number - userVal = loc.toDouble(formattedValue); - if (userVal >= 1.0) - // we can assure we didn't make an error > 10% via getUserString() - checkDecimals = false; - } - if (checkDecimals){ + userVal = asQuantity.getValue(); + } else { // get value in the base unit with default decimals // for the conversion we use the same method as in DlgUnitsCalculator::valueChanged // get the conversion factor for the unit @@ -750,7 +741,6 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int //qUserString from Quantity includes units - prefix + R + nnn ft + suffix qMultiValueStr = formatPrefix + qGenPrefix + qUserString + formatSuffix; } - formattedValue = qMultiValueStr; }