Home · All Classes · Modules

QDoubleValidator Class Reference
[QtGui module]

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

Inherits QValidator.

Methods


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.


Method Documentation

QDoubleValidator.__init__ (self, QObject parent)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

QDoubleValidator.__init__ (self, float bottom, float top, int decimals, QObject parent)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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.

float QDoubleValidator.bottom (self)

int QDoubleValidator.decimals (self)

QDoubleValidator.setBottom (self, float)

QDoubleValidator.setDecimals (self, int)

QDoubleValidator.setRange (self, float bottom, float top, int decimals = 0)

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

QDoubleValidator.setTop (self, float)

float QDoubleValidator.top (self)

(QValidator.State, int) QDoubleValidator.validate (self, QString, int)

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.


PyQt 4.0.1 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2006Qt 4.1.4