Class: QgsDoubleValidator¶
- class qgis.gui.QgsDoubleValidator¶
Bases:
PyQt5.QtGui.QRegularExpressionValidator
QgsDoubleValidator
is a QLineEdit Validator that combines QDoubleValidator and QRegularExpressionValidator to allow users to enter doubles with both local and C interpretation as a fallback.New in version 3.14.
QgsDoubleValidator(parent: QObject) Constructor for QgsDoubleValidator.
QgsDoubleValidator(expression: QRegularExpression, bottom: float, top: float, parent: QObject) Constructor for QgsDoubleValidator.
- Parameters
bottom – the minimal range limit accepted by the validator
top – the maximal range limit accepted by the validator
parent – parent object
expression – custom regular expression
QgsDoubleValidator(bottom: float, top: float, parent: QObject) Constructor for QgsDoubleValidator.
- Parameters
bottom – the minimal range limit accepted by the validator
top – the maximal range limit accepted by the validator
parent – parent object
QgsDoubleValidator(bottom: float, top: float, decimal: int, parent: QObject) Constructor for QgsDoubleValidator.
- Parameters
bottom – the minimal range limit accepted by the validator
top – the maximal range limit accepted by the validator
decimal – the number of decimals accepted by the validator
parent – parent object
QgsDoubleValidator(decimal: int, parent: QObject) Constructor for QgsDoubleValidator.
- Parameters
decimal – the number of decimals accepted by the validator
parent – parent object
New in version 3.16:
Methods
Returns top range limit
Set top range limit
Sets the number of decimals accepted by the validator to
maxDecimals
.Set bottom and top range limits
Set top range limit
Converts
input
string to double value.Returns top range limit
Evaluates
input
string validity according to QRegularExpression and ability to be converted in double value.- bottom(self) float ¶
Returns top range limit
See also
- Return type
float
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setBottom(self, bottom: float)¶
Set top range limit
See also
See also
- Parameters
bottom (float) –
- setMaxDecimals(self, maxDecimals: int)¶
Sets the number of decimals accepted by the validator to
maxDecimals
.Warning
setting decimals overrides any custom regular expression that was previously set
New in version 3.22.
- Parameters
maxDecimals (int) –
- setRange(self, bottom: float, top: float)¶
Set bottom and top range limits
See also
See also
- Parameters
bottom (float) –
top (float) –
- setTop(self, top: float)¶
Set top range limit
See also
See also
- Parameters
top (float) –
- timerEvent(self, QTimerEvent)¶
- toDouble(input: str) float ¶
Converts
input
string to double value. It uses locale interpretation first and C locale interpretation as fallback- Parameters
input (str) –
- Return type
float
- validate(self, input: str) QValidator.State ¶
Evaluates
input
string validity according to QRegularExpression and ability to be converted in double value.- Parameters
input (str) –
- Return type
QValidator.State