PySide6.QtGui.QDoubleValidator¶
- class QDoubleValidator¶
- The - QDoubleValidatorclass provides range checking of floating-point numbers. More…- Synopsis¶- Properties¶- Methods¶- def - __init__()
- def - bottom()
- def - decimals()
- def - notation()
- def - setBottom()
- def - setDecimals()
- def - setNotation()
- def - setRange()
- def - setTop()
- def - top()
 - Signals¶- def - bottomChanged()
- def - topChanged()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- QDoubleValidatorprovides an upper bound, a lower bound, and a limit on the number of digits after the decimal point.- 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.- QDoubleValidatoruses 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,- QDoubleValidatorwill accept Arabic digits.- Note - The QLocale::NumberOptions set on the - locale()also affect the way the number is interpreted. For example, since QLocale::RejectGroupSeparator is not set by default (except on the- "C"locale), the validator will accept group separators. If the string passes validation, pass it to- locale().toDouble() to obtain its numeric value.- See also - QIntValidator- QRegularExpressionValidator- toDouble()Line Edits Example- class Notation¶
- This enum defines the allowed notations for entering a double. - Constant - Description - QDoubleValidator.StandardNotation - The string is written in the standard format, a whole number part optionally followed by a separator and fractional part, for example - "0.015".- QDoubleValidator.ScientificNotation - The string is written in scientific form, which optionally appends an exponent part to the standard format, for example - "1.5E-2".- The whole number part may, as usual, include a sign. This, along with the separators for fractional part, exponent and any digit-grouping, depend on locale. - QDoubleValidatordoesn’t check the placement (which would also depend on locale) of any digit-grouping separators it finds, but it will reject input that contains them if QLocale::RejectGroupSeparator is set in- locale().numberOptions().- See also - negativeSign()
 - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property bottomᅟ: float¶
 - This property holds the validator’s minimum acceptable value. - By default, this property contains a value of -infinity. - See also - Access functions:
- Signal - bottomChanged()
 
 - property decimalsᅟ: int¶
 - This property holds the validator’s maximum number of digits after the decimal point. - By default, this property contains a value of -1, which means any number of digits is accepted. - See also - Access functions:
 - property notationᅟ: 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 - Access functions:
 - property topᅟ: float¶
 - This property holds the validator’s maximum acceptable value. - By default, this property contains a value of infinity. - See also - Access functions:
- Signal - topChanged()
 
 - Constructs a validator object with a - parentobject that accepts any double.- __init__(bottom, top, decimals[, parent=None])
- Parameters:
- bottom – float 
- top – float 
- decimals – int 
- parent – - QObject
 
 
 - Constructs a validator object with a - parentobject. This validator will accept doubles from- bottomto- topinclusive, with up to- decimalsdigits after the decimal point.- bottom()¶
- Return type:
- float 
 - See also 
 - Getter of property - bottomᅟ.- bottomChanged(bottom)¶
- Parameters:
- bottom – float 
 
 - Notification signal of property - bottomᅟ.- decimals()¶
- Return type:
- int 
 - See also 
 - Getter of property - decimalsᅟ.- decimalsChanged(decimals)¶
- Parameters:
- decimals – int 
 
 - Notification signal of property - decimalsᅟ.- notation()¶
- Return type:
 - See also 
 - Getter of property - notationᅟ.- Notification signal of property - notationᅟ.- Setter of property - bottomᅟ.- setDecimals(arg__1)¶
- Parameters:
- arg__1 – int 
 - See also 
 - Setter of property - decimalsᅟ.- Setter of property - notationᅟ.- setRange(bottom, top)¶
- Parameters:
- bottom – float 
- top – float 
 
 
 - This is an overloaded function. - Sets the validator to accept doubles from - minimumto- maximuminclusive without changing the number of digits after the decimal point.- setRange(bottom, top, decimals)
- Parameters:
- bottom – float 
- top – float 
- decimals – int 
 
 
 - Sets the validator to accept doubles from - minimumto- maximuminclusive, with at most- decimalsdigits after the decimal point.- Note - Setting the number of decimals to -1 effectively sets it to unlimited. This is also the value used by a default-constructed validator. - Setter of property - topᅟ.- Getter of property - topᅟ.- topChanged(top)¶
- Parameters:
- top – float 
 
 - Notification signal of property - topᅟ.