#include <value.h>
|
| Value () |
|
| Value (const QVariant &number, const QString &unitString) |
|
| Value (const Value &other) |
|
| Value (qreal number, const QString &unitString) |
|
| Value (qreal number, const Unit &unit) |
|
| Value (qreal number, UnitId unitId) |
|
| ~Value () |
|
Value | convertTo (const QString &unit) const |
|
Value | convertTo (const Unit &unit) const |
|
Value | convertTo (UnitId unit) const |
|
bool | isNull () const |
|
bool | isValid () const |
|
qreal | number () const |
|
bool | operator!= (const Value &other) const |
|
Value & | operator= (const Value &other) |
|
bool | operator== (const Value &other) const |
|
Value & | round (uint decimals) |
|
void | swap (Value &other) |
|
QString | toString (int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const |
|
QString | toSymbolString (int fieldWidth=0, char format='g', int precision=-1, const QChar &fillChar=QLatin1Char(' ')) const |
|
Unit | unit () const |
|
Class to hold a value in a unit of measurement.
This is a class to hold a value in a unit of measurement.
- See also
- Converter, Unit, UnitCategory
- Author
- Petri Damstén damu@.nosp@m.iki..nosp@m.fi
-
John Layt jlayt.nosp@m.@kde.nosp@m..org
Definition at line 35 of file value.h.
◆ Value() [1/6]
KUnitConversion::Value::Value |
( |
| ) |
|
Creates a null value.
Definition at line 80 of file value.cpp.
◆ Value() [2/6]
KUnitConversion::Value::Value |
( |
qreal | number, |
|
|
const Unit & | unit ) |
Creates a value with a unit instance.
Definition at line 90 of file value.cpp.
◆ Value() [3/6]
KUnitConversion::Value::Value |
( |
qreal | number, |
|
|
const QString & | unitString ) |
Creates a value with a unit (as a string).
Definition at line 95 of file value.cpp.
◆ Value() [4/6]
KUnitConversion::Value::Value |
( |
qreal | number, |
|
|
UnitId | unitId ) |
Creates a value with a unit (as a enum value).
Definition at line 100 of file value.cpp.
◆ Value() [5/6]
KUnitConversion::Value::Value |
( |
const QVariant & | number, |
|
|
const QString & | unitString ) |
Creates a value based on a QVariant (calling toReal() on it) with a unit (as a string).
Definition at line 105 of file value.cpp.
◆ Value() [6/6]
KUnitConversion::Value::Value |
( |
const Value & | other | ) |
|
Copy constructor, copy other
to this.
Definition at line 85 of file value.cpp.
◆ ~Value()
KUnitConversion::Value::~Value |
( |
| ) |
|
◆ convertTo() [1/3]
Value KUnitConversion::Value::convertTo |
( |
const QString & | unit | ) |
const |
convert to another unit
Definition at line 209 of file value.cpp.
◆ convertTo() [2/3]
Value KUnitConversion::Value::convertTo |
( |
const Unit & | unit | ) |
const |
convert to another unit
Definition at line 193 of file value.cpp.
◆ convertTo() [3/3]
Value KUnitConversion::Value::convertTo |
( |
UnitId | unit | ) |
const |
convert to another unit
Definition at line 201 of file value.cpp.
◆ isNull()
bool KUnitConversion::Value::isNull |
( |
| ) |
const |
◆ isValid()
bool KUnitConversion::Value::isValid |
( |
| ) |
const |
Check if value is valid.
- Returns
- True if value is valid
Definition at line 143 of file value.cpp.
◆ number()
qreal KUnitConversion::Value::number |
( |
| ) |
const |
Number part of the value.
Definition at line 148 of file value.cpp.
◆ operator!=()
bool KUnitConversion::Value::operator!= |
( |
const Value & | other | ) |
const |
◆ operator=()
Value & KUnitConversion::Value::operator= |
( |
const Value & | other | ) |
|
Assignment operator, assign other
to this.
Definition at line 114 of file value.cpp.
◆ operator==()
bool KUnitConversion::Value::operator== |
( |
const Value & | other | ) |
const |
◆ round()
Value & KUnitConversion::Value::round |
( |
uint | decimals | ) |
|
rounds value to decimal count
- Parameters
-
Definition at line 180 of file value.cpp.
◆ swap()
void KUnitConversion::Value::swap |
( |
Value & | other | ) |
|
|
inline |
Swaps this Value with other
.
This function is very fast and never fails.
Definition at line 89 of file value.h.
◆ toString()
QString KUnitConversion::Value::toString |
( |
int | fieldWidth = 0, |
|
|
char | format = 'g', |
|
|
int | precision = -1, |
|
|
const QChar & | fillChar = QLatin1Char(' ') ) const |
Convert value to a string.
- Parameters
-
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 as a string
Definition at line 164 of file value.cpp.
◆ toSymbolString()
QString KUnitConversion::Value::toSymbolString |
( |
int | fieldWidth = 0, |
|
|
char | format = 'g', |
|
|
int | precision = -1, |
|
|
const QChar & | fillChar = QLatin1Char(' ') ) const |
Convert value to a string with symbol.
- Parameters
-
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 as a string
Definition at line 172 of file value.cpp.
◆ unit()
Unit KUnitConversion::Value::unit |
( |
| ) |
const |
The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:12 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.