Merge pull request #4109 from donovaly/TD-dimensioning-fix
[TD] treat dimensions the same way, no matter if with unit or not
This commit is contained in:
@@ -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 in the base unit but without displayed unit
|
||||||
// - the value + unit (not necessarily the base 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
|
// 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;
|
QLocale loc;
|
||||||
double userVal;
|
double userVal;
|
||||||
bool checkDecimals = true;
|
|
||||||
if (showUnits() || (Type.isValue("Angle")) || (Type.isValue("Angle3Pt"))) {
|
if (showUnits() || (Type.isValue("Angle")) || (Type.isValue("Angle3Pt"))) {
|
||||||
formattedValue = qUserString; // result value + unit (not necessarily base unit!)
|
userVal = asQuantity.getValue();
|
||||||
// remove unit
|
} else {
|
||||||
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){
|
|
||||||
// get value in the base unit with default decimals
|
// get value in the base unit with default decimals
|
||||||
// for the conversion we use the same method as in DlgUnitsCalculator::valueChanged
|
// for the conversion we use the same method as in DlgUnitsCalculator::valueChanged
|
||||||
// get the conversion factor for the unit
|
// 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
|
//qUserString from Quantity includes units - prefix + R + nnn ft + suffix
|
||||||
qMultiValueStr = formatPrefix + qGenPrefix + qUserString + formatSuffix;
|
qMultiValueStr = formatPrefix + qGenPrefix + qUserString + formatSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
formattedValue = qMultiValueStr;
|
formattedValue = qMultiValueStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user