All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpGuiTools::NumericalLineEdit Class Reference

Brief description of class still missing. More...

#include <NumericalLineEdit.h>

List of all members.

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

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References TRACE.

    : QLineEdit(parent)
{
  TRACE;
  setValidator(new QDoubleValidator(this));
  setAlignment(Qt::AlignRight);
}

Member Function Documentation

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

References text(), and TRACE.

{
  TRACE;
  return QLineEdit::text().toDouble(ok);
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines