fix negative value cascading in unti schemas

This commit is contained in:
jriegel 2013-12-16 00:02:58 +01:00
parent 9d217367e9
commit 73684a9fdb
3 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ using namespace Base;
QString UnitsSchemaImperial1::schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)
{
double UnitValue = quant.getValue();
double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit();
// for imperial user/programmer mind; UnitValue is in internal system, that means
// mm/kg/s. And all combined units have to be calculated from there!
@ -115,5 +115,5 @@ QString UnitsSchemaImperial1::schemaTranslate(Base::Quantity quant,double &facto
unitString = quant.getUnit().getString();
factor = 1.0;
}
return QString::fromLatin1("%1 %2").arg(UnitValue / factor).arg(unitString);
return QString::fromLatin1("%1 %2").arg(quant.getValue() / factor).arg(unitString);
}

View File

@ -36,7 +36,7 @@ using namespace Base;
QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)
{
double UnitValue = quant.getValue();
double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit();
// now do special treatment on all cases seams nececarry:
@ -97,6 +97,6 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
unitString = quant.getUnit().getString();
factor = 1.0;
}
return QString::fromUtf8("%1 %2").arg(UnitValue / factor).arg(unitString);
return QString::fromUtf8("%1 %2").arg(quant.getValue() / factor).arg(unitString);
}

View File

@ -36,7 +36,7 @@ using namespace Base;
QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QString &unitString)
{
double UnitValue = quant.getValue();
double UnitValue = std::abs(quant.getValue());
Unit unit = quant.getUnit();
// now do special treatment on all cases seams nececarry:
@ -92,5 +92,5 @@ QString UnitsSchemaMKS::schemaTranslate(Base::Quantity quant,double &factor,QStr
unitString = quant.getUnit().getString();
factor = 1.0;
}
return QString::fromUtf8("%1 %2").arg(UnitValue / factor).arg(unitString);
return QString::fromUtf8("%1 %2").arg(quant.getValue() / factor).arg(unitString);
}