mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Ref T554, PQ "valueRoundedAsString"
This commit is contained in:
committed by
Mat Sutcliffe
parent
fe2d092891
commit
3e0d318a48
@@ -370,6 +370,13 @@ namespace BlackMisc
|
|||||||
return this->valueRounded(m_unit, digits);
|
return this->valueRounded(m_unit, digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class MU, class PQ>
|
||||||
|
QString CPhysicalQuantity<MU, PQ>::valueRoundedAsString(MU unit, int digits) const
|
||||||
|
{
|
||||||
|
const double v = this->valueRounded(unit, digits);
|
||||||
|
return QString::number(v, 'f', digits);
|
||||||
|
}
|
||||||
|
|
||||||
template <class MU, class PQ>
|
template <class MU, class PQ>
|
||||||
double CPhysicalQuantity<MU, PQ>::value(MU unit) const
|
double CPhysicalQuantity<MU, PQ>::value(MU unit) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,10 +102,6 @@ namespace BlackMisc
|
|||||||
//! Set value in current unit
|
//! Set value in current unit
|
||||||
void setCurrentUnitValue(double value);
|
void setCurrentUnitValue(double value);
|
||||||
|
|
||||||
//! Rounded value in given unit
|
|
||||||
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
|
||||||
double valueRounded(MU unit, int digits = -1) const;
|
|
||||||
|
|
||||||
//! As integer value
|
//! As integer value
|
||||||
int valueInteger(MU unit) const;
|
int valueInteger(MU unit) const;
|
||||||
|
|
||||||
@@ -115,10 +111,18 @@ namespace BlackMisc
|
|||||||
//! Is value an integer
|
//! Is value an integer
|
||||||
bool isInteger() const;
|
bool isInteger() const;
|
||||||
|
|
||||||
|
//! Rounded value in given unit
|
||||||
|
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
||||||
|
double valueRounded(MU unit, int digits = -1) const;
|
||||||
|
|
||||||
//! Rounded value in current unit
|
//! Rounded value in current unit
|
||||||
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
||||||
double valueRounded(int digits = -1) const;
|
double valueRounded(int digits = -1) const;
|
||||||
|
|
||||||
|
//! Rounded value in given unit
|
||||||
|
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
||||||
|
QString valueRoundedAsString(MU unit, int digits = -1) const;
|
||||||
|
|
||||||
//! Value to QString with the given unit, e.g. "5.00m"
|
//! Value to QString with the given unit, e.g. "5.00m"
|
||||||
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
//! \note default digits is CMeasurementUnit::getDisplayDigits
|
||||||
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool withGroupSeparator = false, bool i18n = false) const;
|
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool withGroupSeparator = false, bool i18n = false) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user