#include <inttofloat.h>
Public Slots | |
void | value (int n) |
convert int to double | |
void | value (double n) |
convert double to int | |
Signals | |
void | valueChanged (double) |
Announce the new double value. | |
void | valueChanged (int) |
Announce the new int value. | |
Public Member Functions | |
IntToFloat (double precision, QObject *p) | |
Creates a new Integer-to-Double-converter with the given precision. | |
IntToFloat (double precision, NSCore::NamedParameterTreeItem *item, QObject *p) | |
Creates a new Integer-to-Double-converter with the given precision and connects to the given NSCore::NamedParameterTreeItem. | |
Private Attributes | |
double | _precision |
NSCore::NamedParameterTreeItem * | _parameter |
IntToFloat converts int-signals to float-signals with a given precision.
The precision means that that the int is multiplied with precision to form the float value. So an int of 8 times a precision of 1E-2 gives 0.08 for the result. The conversion backwards is also done by this class.
NSCore::IntToFloat::IntToFloat | ( | double | precision, | |
QObject * | p | |||
) | [inline] |
Creates a new Integer-to-Double-converter with the given precision.
precision | should be given in the style 1E-3 | |
p | the parent QObject |
NSCore::IntToFloat::IntToFloat | ( | double | precision, | |
NSCore::NamedParameterTreeItem * | item, | |||
QObject * | p | |||
) |
Creates a new Integer-to-Double-converter with the given precision and connects to the given NSCore::NamedParameterTreeItem.
precision | should be given in the style 1E-3 | |
item | the NamedParameterTreeItem to connect to | |
p | the parent QObject |
void NSCore::IntToFloat::value | ( | int | n | ) | [inline, slot] |
convert int to double
This function converts the given integer to a float by multiplying with the precision given at creation-time.
References _precision, and valueChanged().
void NSCore::IntToFloat::value | ( | double | n | ) | [inline, slot] |
convert double to int
This function converts the given double to an int by dividing with the precision and rounding to int.
References _precision, and valueChanged().
void NSCore::IntToFloat::valueChanged | ( | double | ) | [signal] |
void NSCore::IntToFloat::valueChanged | ( | int | ) | [signal] |
Announce the new int value.
double NSCore::IntToFloat::_precision [private] |
Referenced by value().