|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QDoubleValidator Class Reference
[QtGui module]

The QDoubleValidator class provides range checking of floating-point numbers. More...

    #include <QDoubleValidator>

Inherits QValidator.

- List of all members, including inherited members
- Qt 3 support members

### Properties

- bottom : double
- decimals : int
- top : double

- 1 property inherited from QObject

### Public Functions

- QDoubleValidator ( QObject * parent )
- QDoubleValidator ( double bottom, double top, int decimals, QObject * parent )
- ~QDoubleValidator ()
- double bottom () const
- int decimals () const
- void setBottom ( double )
- void setDecimals ( int )
- virtual void setRange ( double minimum, double maximum, int decimals = 0 )
- void setTop ( double )
- double top () const
- virtual QValidator::State validate ( QString & input, int & pos ) const

- 2 public functions inherited from QValidator
- 28 public functions inherited from QObject

### Additional Inherited Members

- 1 public slot inherited from QObject
- 1 signal inherited from QObject
- 4 static public members inherited from QObject
- 7 protected functions inherited from QObject

## Detailed Description

The QDoubleValidator class provides range checking of floating-point numbers.

QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a fixup() function.

You can set the acceptable range in one call with setRange(), or with setBottom() and setTop(). Set the number of decimal places with setDecimals(). The validate() function returns the validation state.

See also QIntValidator and QRegExpValidator.

## Property Documentation

### bottom : double

This property holds the validator's minimum acceptable value.

Access functions:

- double bottom () const
- void setBottom ( double )

See also setRange().

### decimals : int

This property holds the validator's maximum number of digits after the decimal point.

Access functions:

- int decimals () const
- void setDecimals ( int )

See also setRange().

### top : double

This property holds the validator's maximum acceptable value.

Access functions:

- double top () const
- void setTop ( double )

See also setRange().

## Member Function Documentation

### QDoubleValidator::QDoubleValidator ( QObject * parent )

Constructs a validator object with a parent object that accepts any double.

### QDoubleValidator::QDoubleValidator ( double bottom, double top, int decimals, QObject * parent )

Constructs a validator object with a parent object. This validator will accept doubles from bottom to top inclusive, with up to decimals digits after the decimal point.

### QDoubleValidator::~QDoubleValidator ()

Destroys the validator.

### void QDoubleValidator::setRange ( double minimum, double maximum, int decimals = 0 ) `[virtual]`

Sets the validator to accept doubles from minimum to maximum inclusive, with at most decimals digits after the decimal point.

### QValidator::State QDoubleValidator::validate ( QString & input, int & pos ) const `[virtual]`

Returns Acceptable if the string input contains a double that is within the valid range and is in the correct format.

Returns Intermediate if input contains a double that is outside the range or is in the wrong format; e.g. with too many digits after the decimal point or is empty.

Returns Invalid if the input is not a double.

Note: If the valid range consists of just positive doubles (e.g. 0.0 to 100.0) and input is a negative double then Invalid is returned.

By default, the pos parameter is not used by this validator.

Reimplemented from QValidator.