qdoublevalidator.3qt man page

QDoubleValidator — Range checking of floating-point numbers

Synopsis

#include <qvalidator.h>

Inherits QValidator.

Public Members

QDoubleValidator ( QObject * parent, const char * name = 0 )

QDoubleValidator ( double bottom, double top, int decimals, QObject * parent, const char * name = 0 )

~QDoubleValidator ()

virtual QValidator::State validate ( QString & input, int & ) const

virtual void setRange ( double minimum, double maximum, int decimals = 0 )

void setBottom ( double )

void setTop ( double )

void setDecimals ( int )

double bottom () const

double top () const

int decimals () const

Properties

double bottom - the validator's minimum acceptable value

int decimals - the validator's maximum number of digits after the decimal point

double top - the validator's maximum acceptable value

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, QRegExpValidator, and Miscellaneous Classes.

QDoubleValidator::QDoubleValidator ( QObject * parent, const char * name = 0 )

Constructs a validator object with parent parent, called name, which accepts any double.

QDoubleValidator::QDoubleValidator ( double bottom, double top, int decimals, QObject * parent, const char * name = 0 )

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

QDoubleValidator::~QDoubleValidator ()

Destroys the validator, freeing any resources used.

double QDoubleValidator::bottom () const

Returns the validator's minimum acceptable value. See the "bottom" property for details.

int QDoubleValidator::decimals () const

Returns the validator's maximum number of digits after the decimal point. See the "decimals" property for details.

void QDoubleValidator::setBottom ( double )

Sets the validator's minimum acceptable value. See the "bottom" property for details.

void QDoubleValidator::setDecimals ( int )

Sets the validator's maximum number of digits after the decimal point. See the "decimals" property for details.

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.

void QDoubleValidator::setTop ( double )

Sets the validator's maximum acceptable value. See the "top" property for details.

double QDoubleValidator::top () const

Returns the validator's maximum acceptable value. See the "top" property for details.

QValidator::State QDoubleValidator::validate ( QString & input, int & ) 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 - 100.0) and input is a negative double then Invalid is returned.

Reimplemented from QValidator.

Property Documentation

double bottom

This property holds the validator's minimum acceptable value.

Set this property's value with setBottom() and get this property's value with bottom().

See also setRange().

int decimals

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

Set this property's value with setDecimals() and get this property's value with decimals().

See also setRange().

double top

This property holds the validator's maximum acceptable value.

Set this property's value with setTop() and get this property's value with top().

See also setRange().

See Also

http://doc.trolltech.com/qdoublevalidat… http://www.trolltech.com/faq/tech.html

Author

Generated automatically from the source code.

Bugs

If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qdoublevalidator.3qt) and the Qt version (3.3.8).

Referenced By

QDoubleValidator.3qt(3) is an alias of qdoublevalidator.3qt(3).

2 February 2007 Trolltech AS