Commit 6020fc18 authored by Lorenz Meier's avatar Lorenz Meier

Scale increment and decimal fields according to cooked unit, so that the...

Scale increment and decimal fields according to cooked unit, so that the decimal and increments provided by meta data still work in the cooked display
parent 39913696
......@@ -596,7 +596,7 @@ int FactMetaData::decimalPlaces(void) const
int incrementDecimalPlaces = unknownDecimalPlaces;
// First determine decimal places from increment
double increment = this->increment();
double increment = _rawTranslator(this->increment()).toDouble();
if (!qIsNaN(increment)) {
double integralPart;
......@@ -614,7 +614,16 @@ int FactMetaData::decimalPlaces(void) const
if (incrementDecimalPlaces != unknownDecimalPlaces && _decimalPlaces == unknownDecimalPlaces) {
actualDecimalPlaces = incrementDecimalPlaces;
} else {
actualDecimalPlaces = qMax(_decimalPlaces, incrementDecimalPlaces);
int settingsDecimalPlaces = _decimalPlaces;
double ctest = _rawTranslator(1.0).toDouble();
settingsDecimalPlaces += -log10(ctest);
settingsDecimalPlaces = qMin(25, settingsDecimalPlaces);
settingsDecimalPlaces = qMax(0, settingsDecimalPlaces);
actualDecimalPlaces = qMax(settingsDecimalPlaces, incrementDecimalPlaces);
}
return actualDecimalPlaces;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment