QDoubleValidator

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

Inheritance diagram of PySide2.QtGui.QDoubleValidator

Synopsis

Functions

Virtual functions

  • def setRange (bottom, top[, decimals=0])

Signals

Detailed Description

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.

QDoubleValidator uses its locale() to interpret the number. For example, in the German locale, “1,234” will be accepted as the fractional number 1.234. In Arabic locales, QDoubleValidator will accept Arabic digits.

Note

The NumberOptions set on the locale() also affect the way the number is interpreted. For example, since RejectGroupSeparator is not set by default, the validator will accept group separators. It is thus recommended to use toDouble() to obtain the numeric value.

class QDoubleValidator([parent=None])

QDoubleValidator(bottom, top, decimals[, parent=None])

param parent

QObject

param bottom

double

param top

double

param decimals

int

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

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.

PySide2.QtGui.QDoubleValidator.Notation

This enum defines the allowed notations for entering a double.

Constant

Description

QDoubleValidator.StandardNotation

The string is written as a standard number (i.e. 0.015).

QDoubleValidator.ScientificNotation

The string is written in scientific form. It may have an exponent part(i.e. 1.5E-2).

PySide2.QtGui.QDoubleValidator.bottom()
Return type

double

See also

setBottom()

PySide2.QtGui.QDoubleValidator.bottomChanged(bottom)
Parameters

bottomdouble

PySide2.QtGui.QDoubleValidator.decimals()
Return type

int

See also

setDecimals()

PySide2.QtGui.QDoubleValidator.decimalsChanged(decimals)
Parameters

decimalsint

PySide2.QtGui.QDoubleValidator.notation()
Return type

Notation

See also

setNotation()

PySide2.QtGui.QDoubleValidator.notationChanged(notation)
Parameters

notationNotation

PySide2.QtGui.QDoubleValidator.setBottom(arg__1)
Parameters

arg__1double

See also

bottom()

PySide2.QtGui.QDoubleValidator.setDecimals(arg__1)
Parameters

arg__1int

See also

decimals()

PySide2.QtGui.QDoubleValidator.setNotation(arg__1)
Parameters

arg__1Notation

See also

notation()

PySide2.QtGui.QDoubleValidator.setRange(bottom, top[, decimals=0])
Parameters
  • bottomdouble

  • topdouble

  • decimalsint

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

PySide2.QtGui.QDoubleValidator.setTop(arg__1)
Parameters

arg__1double

See also

top()

PySide2.QtGui.QDoubleValidator.top()
Return type

double

See also

setTop()

PySide2.QtGui.QDoubleValidator.topChanged(top)
Parameters

topdouble