All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Brief description of class still missing. More...
#include <NumericalLineEdit.h>
Public Member Functions | |
| NumericalLineEdit (QWidget *parent=0) | |
| void | setText () |
| void | setValue (double v, Number::Type type=Number::Fixed, int precision=-6) |
| QString | text (double) const |
| double | value (bool *ok=0) const |
Brief description of class still missing.
Full description of class still missing
| QGpGuiTools::NumericalLineEdit::NumericalLineEdit | ( | QWidget * | parent = 0 | ) |
| void QGpGuiTools::NumericalLineEdit::setText | ( | ) | [inline] |
Referenced by setValue().
{}
| void QGpGuiTools::NumericalLineEdit::setValue | ( | double | v, |
| Number::Type | type = Number::Fixed, |
||
| int | precision = -6 |
||
| ) |
Set current value to v. Negative precisions are considered as maximum precision.
References setText(), and TRACE.
{
TRACE;
// Eventually set automatic precision
if(precision<0) {
precision=-precision;
double vr=floor(v);
double vf=v;
int i;
for(i=0;i<precision && vr!=vf;i++) {
vf*=10.0;
vr=floor(vf);
}
precision=i;
}
QLocale dl;
dl.setNumberOptions(QLocale::OmitGroupSeparator);
QLineEdit::setText(dl.toString(v, Number::type(type), precision));
}
| QString QGpGuiTools::NumericalLineEdit::text | ( | double | ) | const [inline] |
Referenced by value().
{return QLineEdit::text();}
| double QGpGuiTools::NumericalLineEdit::value | ( | bool * | ok = 0 | ) | const |
Returns current value
{
TRACE;
return QLineEdit::text().toDouble(ok);
}