Class to define a unit of measurement.
More...
#include <unit.h>
|
| Unit () |
| Null constructor.
|
|
| Unit (const Unit &other) |
| Copy constructor, copy other to this.
|
|
UnitCategory | category () const |
|
CategoryId | categoryId () const |
|
QString | description () const |
|
UnitId | id () const |
|
bool | isNull () const |
|
bool | isValid () const |
|
bool | operator!= (const Unit &other) const |
|
Unit & | operator= (const Unit &other) |
| Assignment operator, assign other to this.
|
|
bool | operator== (const Unit &other) const |
|
void | swap (Unit &other) |
| Swaps this Unit with other .
|
|
QString | symbol () const |
|
QString | toString (qreal value, int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const |
|
QString | toSymbolString (qreal value, int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const |
|
|
qreal | fromDefault (qreal value) const |
|
qreal | toDefault (qreal value) const |
|
Class to define a unit of measurement.
This is a class to define a unit of measurement.
- See also
- Converter, UnitCategory, Value
- Author
- Petri Damstén damu@.nosp@m.iki..nosp@m.fi
-
John Layt jlayt.nosp@m.@kde.nosp@m..org
◆ Unit() [1/2]
KUnitConversion::Unit::Unit |
( |
| ) |
|
◆ Unit() [2/2]
KUnitConversion::Unit::Unit |
( |
const Unit & |
other | ) |
|
Copy constructor, copy other
to this.
◆ category()
◆ categoryId()
CategoryId KUnitConversion::Unit::categoryId |
( |
| ) |
const |
◆ description()
QString KUnitConversion::Unit::description |
( |
| ) |
const |
- Returns
- translated name for unit.
◆ id()
UnitId KUnitConversion::Unit::id |
( |
| ) |
const |
◆ isNull()
bool KUnitConversion::Unit::isNull |
( |
| ) |
const |
- Returns
- returns true if this Unit is null
◆ isValid()
bool KUnitConversion::Unit::isValid |
( |
| ) |
const |
◆ operator!=()
bool KUnitConversion::Unit::operator!= |
( |
const Unit & |
other | ) |
const |
- Returns
true
if this Unit is not equal to the other
Unit.
◆ operator=()
Unit & KUnitConversion::Unit::operator= |
( |
const Unit & |
other | ) |
|
Assignment operator, assign other
to this.
◆ operator==()
bool KUnitConversion::Unit::operator== |
( |
const Unit & |
other | ) |
const |
- Returns
true
if this Unit is equal to the other
Unit.
◆ swap()
void KUnitConversion::Unit::swap |
( |
Unit & |
other | ) |
|
|
inline |
Swaps this Unit with other
.
This function is very fast and never fails.
◆ symbol()
QString KUnitConversion::Unit::symbol |
( |
| ) |
const |
- Returns
- symbol for the unit.
◆ toString()
QString KUnitConversion::Unit::toString |
( |
qreal |
value, |
|
|
int |
fieldWidth = 0 , |
|
|
char |
format = 'g' , |
|
|
int |
precision = -1 , |
|
|
const QChar & |
fillChar = QLatin1Char(' ') |
|
) |
| const |
- Parameters
-
value | number value |
fieldWidth | width of the formatted field, padded by spaces. Positive value aligns right, negative aligns left |
format | type of floating point formatting, like in QString::arg |
precision | number of digits after the decimal separator |
fillChar | the character used to fill up the empty places when field width is greater than argument width |
- Returns
- value + unit string
◆ toSymbolString()
QString KUnitConversion::Unit::toSymbolString |
( |
qreal |
value, |
|
|
int |
fieldWidth = 0 , |
|
|
char |
format = 'g' , |
|
|
int |
precision = -1 , |
|
|
const QChar & |
fillChar = QLatin1Char(' ') |
|
) |
| const |
- Parameters
-
value | number value |
fieldWidth | width of the formatted field, padded by spaces. Positive value aligns right, negative aligns left |
format | type of floating point formatting, like in QString::arg |
precision | number of digits after the decimal separator |
fillChar | the character used to fill up the empty places when field width is greater than argument width |
- Returns
- value + unit string