add class QuantityFormat to control user string of Quantity

do some code refactoration to reduce duplicate code
This commit is contained in:
wmayer
2016-08-06 19:06:29 +02:00
parent 4d8b05e401
commit 61b62ee314
10 changed files with 271 additions and 234 deletions

View File

@@ -60,9 +60,5 @@ QString UnitsSchemaCentimeters::schemaTranslate(const Base::Quantity& quant, dou
factor = 1.0;
}
//return QString::fromUtf8("%L1 %2").arg(quant.getValue() / factor).arg(unitString);
QLocale Lc = QLocale::system();
Lc.setNumberOptions(Lc.OmitGroupSeparator | Lc.RejectGroupSeparator);
QString Ln = Lc.toString((quant.getValue() / factor), 'f', Base::UnitsApi::getDecimals());
return QString::fromUtf8("%1 %2").arg(Ln).arg(unitString);
return toLocale(quant, factor, unitString);
}