KUnitConversion
Go to the documentation of this file.
33 unit = converter.unit(u);
42 Private(
double n,
const QString& u)
45 unit = converter.unit(u);
58 : d(new
Value::Private())
63 : d(new
Value::Private(n, u))
68 : d(new
Value::Private(n, u))
73 : d(new
Value::Private(n, u))
78 : d(new
Value::Private(n.toDouble(), u))
89 return (d->unit && d->unit->isValid());
92 QString
Value::toString(
int fieldWidth,
char format,
int precision,
const QChar& fillChar)
const
95 return d->unit->toString(d->number, fieldWidth, format, precision, fillChar);
101 const QChar& fillChar)
const
104 return d->unit->toSymbolString(d->number, fieldWidth, format, precision, fillChar);
111 uint div = qPow(10, decimals);
112 double add = 0.5 / (double)div;
114 d->number = (int)((d->number + add) * div) / (
double)div;
133 d->number = value.d->number;
134 d->unit = value.d->unit;
140 return d->converter.convert(*
this,
unit);
145 return d->converter.convert(*
this,
unit);
150 return d->converter.convert(*
this,
unit);
KSharedPtr< Unit > UnitPtr
QString toSymbolString(int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
Convert value to a string with symbol.
QString toString(int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const
Convert value to a string.
Value & round(uint decimals)
rounds value to decimal count
Value convertTo(UnitPtr unit) const
convert to another unit
double number() const
Number part of the value.
UnitPtr unit() const
Unit part of the value.
bool isValid() const
Check if value is valid.
Value & operator=(const Value &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 27 2020 00:00:00 by
doxygen 1.8.20 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.