QDoubleValidator¶
The
QDoubleValidator
class 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
()
Signals¶
def
bottomChanged
(bottom)def
decimalsChanged
(decimals)def
notationChanged
(notation)def
topChanged
(top)
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 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.
QDoubleValidator
uses 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,QDoubleValidator
will accept Arabic digits.Note
The
NumberOptions
set on thelocale()
also affect the way the number is interpreted. For example, sinceRejectGroupSeparator
is not set by default, the validator will accept group separators. It is thus recommended to usetoDouble()
to obtain the numeric value.See also
QIntValidator
QRegExpValidator
toDouble()
Line Edits Example
-
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 frombottom
totop
inclusive, with up todecimals
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
-
PySide2.QtGui.QDoubleValidator.
bottomChanged
(bottom)¶ - Parameters
bottom –
double
-
PySide2.QtGui.QDoubleValidator.
decimals
()¶ - Return type
int
See also
-
PySide2.QtGui.QDoubleValidator.
decimalsChanged
(decimals)¶ - Parameters
decimals –
int
-
PySide2.QtGui.QDoubleValidator.
notation
()¶ - Return type
See also
-
PySide2.QtGui.QDoubleValidator.
setDecimals
(arg__1)¶ - Parameters
arg__1 –
int
See also
-
PySide2.QtGui.QDoubleValidator.
setRange
(bottom, top[, decimals=0])¶ - Parameters
bottom –
double
top –
double
decimals –
int
Sets the validator to accept doubles from
minimum
tomaximum
inclusive, with at mostdecimals
digits after the decimal point.
-
PySide2.QtGui.QDoubleValidator.
topChanged
(top)¶ - Parameters
top –
double
© 2018 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.