QDoubleValidator¶
The
QDoubleValidatorclass provides range checking of floating-point numbers. More…

Synopsis¶
Functions¶
def
bottom()def
decimals()def
notation()def
setBottom(arg__1)def
setDecimals(arg__1)def
setNotation(arg__1)def
setTop(arg__1)def
top()
Virtual functions¶
def
setRange(bottom, top[, decimals=0])
Signals¶
def
bottomChanged(bottom)def
decimalsChanged(decimals)def
notationChanged(notation)def
topChanged(top)
Detailed Description¶
QDoubleValidatorprovides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide afixup()function.You can set the acceptable range in one call with
setRange(), or withsetBottom()andsetTop(). Set the number of decimal places withsetDecimals(). Thevalidate()function returns the validation state.
QDoubleValidatoruses itslocale()to interpret the number. For example, in the German locale, “1,234” will be accepted as the fractional number 1.234. In Arabic locales,QDoubleValidatorwill accept Arabic digits.Note
The
NumberOptionsset on thelocale()also affect the way the number is interpreted. For example, sinceRejectGroupSeparatoris not set by default, the validator will accept group separators. It is thus recommended to usetoDouble()to obtain the numeric value.See also
QIntValidatorQRegExpValidatortoDouble()Line Edits Example
- class PySide2.QtGui.QDoubleValidator([parent=None])¶
PySide2.QtGui.QDoubleValidator(bottom, top, decimals[, parent=None])
- param parent:
- param bottom:
double- param top:
double- param decimals:
int
Constructs a validator object with a
parentobject that accepts any double.Constructs a validator object with a
parentobject. This validator will accept doubles frombottomtotopinclusive, with up todecimalsdigits 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
This property holds the validator’s minimum acceptable value.
By default, this property contains a value of -infinity.
See also
- PySide2.QtGui.QDoubleValidator.bottomChanged(bottom)¶
- Parameters:
bottom –
double
- PySide2.QtGui.QDoubleValidator.decimals()¶
- Return type:
int
This property holds the validator’s maximum number of digits after the decimal point.
By default, this property contains a value of 1000.
See also
- PySide2.QtGui.QDoubleValidator.decimalsChanged(decimals)¶
- Parameters:
decimals – int
- PySide2.QtGui.QDoubleValidator.notation()¶
- Return type:
This property holds the notation of how a string can describe a number.
By default, this property is set to
ScientificNotation.See also
Notation
- PySide2.QtGui.QDoubleValidator.setBottom(arg__1)¶
- Parameters:
arg__1 –
double
This property holds the validator’s minimum acceptable value.
By default, this property contains a value of -infinity.
See also
- PySide2.QtGui.QDoubleValidator.setDecimals(arg__1)¶
- Parameters:
arg__1 – int
This property holds the validator’s maximum number of digits after the decimal point.
By default, this property contains a value of 1000.
See also
- PySide2.QtGui.QDoubleValidator.setNotation(arg__1)¶
- Parameters:
arg__1 –
Notation
This property holds the notation of how a string can describe a number.
By default, this property is set to
ScientificNotation.See also
Notation
- PySide2.QtGui.QDoubleValidator.setRange(bottom, top[, decimals=0])¶
- Parameters:
bottom –
doubletop –
doubledecimals – int
Sets the validator to accept doubles from
minimumtomaximuminclusive, with at mostdecimalsdigits after the decimal point.
- PySide2.QtGui.QDoubleValidator.setTop(arg__1)¶
- Parameters:
arg__1 –
double
This property holds the validator’s maximum acceptable value.
By default, this property contains a value of infinity.
See also
- PySide2.QtGui.QDoubleValidator.top()¶
- Return type:
double
This property holds the validator’s maximum acceptable value.
By default, this property contains a value of infinity.
See also
- PySide2.QtGui.QDoubleValidator.topChanged(top)¶
- Parameters:
top –
double
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.