QDoubleValidator

Inheritance diagram of QDoubleValidator

Synopsis

Functions

Virtual functions

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

Detailed Description

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

PySide.QtGui.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 PySide.QtGui.QValidator.fixup() function.

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

PySide.QtGui.QDoubleValidator uses its PySide.QtGui.QValidator.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, PySide.QtGui.QDoubleValidator will accept Arabic digits.

In addition, PySide.QtGui.QDoubleValidator is always guaranteed to accept a number formatted according to the “C” locale. PySide.QtGui.QDoubleValidator will not accept numbers with thousand-separators.

class PySide.QtGui.QDoubleValidator([parent=None])
class PySide.QtGui.QDoubleValidator(bottom, top, decimals, parent)
Parameters:
  • decimalsPySide.QtCore.int
  • bottomPySide.QtCore.double
  • parentPySide.QtCore.QObject
  • topPySide.QtCore.double

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.

PySide.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).
PySide.QtGui.QDoubleValidator.bottom()
Return type:PySide.QtCore.double

This property holds the validator’s minimum acceptable value.

By default, this property contains a value of -infinity.

PySide.QtGui.QDoubleValidator.decimals()
Return type:PySide.QtCore.int

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

By default, this property contains a value of 1000.

PySide.QtGui.QDoubleValidator.notation()
Return type:PySide.QtGui.QDoubleValidator.Notation

This property holds the notation of how a string can describe a number.

By default, this property is set to ScientificNotation .

See also

QDoubleValidator.Notation

PySide.QtGui.QDoubleValidator.setBottom(arg__1)
Parameters:arg__1PySide.QtCore.double

This property holds the validator’s minimum acceptable value.

By default, this property contains a value of -infinity.

PySide.QtGui.QDoubleValidator.setDecimals(arg__1)
Parameters:arg__1PySide.QtCore.int

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

By default, this property contains a value of 1000.

PySide.QtGui.QDoubleValidator.setNotation(arg__1)
Parameters:arg__1PySide.QtGui.QDoubleValidator.Notation

This property holds the notation of how a string can describe a number.

By default, this property is set to ScientificNotation .

See also

QDoubleValidator.Notation

PySide.QtGui.QDoubleValidator.setRange(bottom, top[, decimals=0])
Parameters:
  • bottomPySide.QtCore.double
  • topPySide.QtCore.double
  • decimalsPySide.QtCore.int

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

PySide.QtGui.QDoubleValidator.setTop(arg__1)
Parameters:arg__1PySide.QtCore.double

This property holds the validator’s maximum acceptable value.

By default, this property contains a value of infinity.

PySide.QtGui.QDoubleValidator.top()
Return type:PySide.QtCore.double

This property holds the validator’s maximum acceptable value.

By default, this property contains a value of infinity.