6 #include <QCoreApplication>
20 namespace swift::misc::physical_quantities
31 Q_ASSERT(digits >= 0);
35 const char *fmt = value < 0 ?
"-%1 %2 %3" :
"%1 %2 %3";
37 s = s.
arg(fabs(de), 0,
'f', 0).
arg(fabs(mi), 2,
'f', 0,
'0').
arg(fabs(se), 3 + digits,
'f', digits,
'0');
42 Q_ASSERT(digits >= 0);
45 const char *fmt = value < 0 ?
"-%1 %2" :
"%1 %2";
47 s = s.
arg(fabs(de), 0,
'f', 0).
arg(fabs(mi), 3 + digits,
'f', digits,
'0');
60 Q_ASSERT(digits >= 0);
64 const char *fmt = value < 0 ?
"-%1h%2m%3s" :
"%1h%2m%3s";
66 s =
s.arg(fabs(hr), 2,
'f', 0,
'0')
67 .arg(fabs(mi), 2,
'f', 0,
'0')
68 .arg(fabs(se), 3 + digits,
'f', digits,
'0');
73 Q_ASSERT(digits >= 0);
76 const char *fmt = value < 0 ?
"-%1h%2m" :
"%1h%2m";
78 s =
s.arg(fabs(hr), 2,
'f', 0,
'0').arg(fabs(mi), 3 + digits,
'f', digits,
'0');
83 Q_ASSERT(digits >= 0);
86 const char *fmt = value < 0 ?
"-%2m%3s" :
"%2m%3s";
88 s =
s.arg(fabs(mi), 2,
'f', 0,
'0').arg(fabs(se), 3 + digits,
'f', digits,
'0');
static double trunc(double value, double epsilon=1e-10)
Nearest integer not greater in magnitude than value, correcting for epsilon.
static CAngleUnit sexagesimalDegMin()
Sexagesimal degree (degrees, minutes, decimal minutes)
QString makeRoundedQStringWithUnit(double value, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
Value rounded with unit, e.g. "5.00m", "30kHz".
static CAngleUnit sexagesimalDeg()
Sexagesimal degree (degrees, minutes, seconds, decimal seconds)
virtual QString makeRoundedQStringWithUnit(double value, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
Value rounded with unit, e.g. "5.00m", "30kHz".
int getDisplayDigits() const
Display digits.
QString makeRoundedQStringWithUnit(double value, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
Value rounded with unit, e.g. "5.00m", "30kHz".
static CTimeUnit hrmin()
Hours, minutes.
static CTimeUnit hms()
Hours, minutes, seconds.
static CTimeUnit s()
Second s.
static CTimeUnit minsec()
Minutes, seconds.
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
QString arg(Args &&... args) const const
#define SWIFT_DEFINE_UNIT_MIXINS(MU)
Explicit template definition of mixins for a CMeasurementUnit subclass.