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

bottom

Returns top range limit

childEvent

connectNotify

customEvent

disconnectNotify

isSignalConnected

receivers

sender

senderSignalIndex

setBottom

Set top range limit

setMaxDecimals

Sets the number of decimals accepted by the validator to maxDecimals.

setRange

Set bottom and top range limits

setTop

Set top range limit

timerEvent

toDouble

Converts input string to double value.

top

Returns top range limit

validate

Evaluates input string validity according to QRegularExpression and ability to be converted in double value.

bottom(self) float

Returns top range limit

See also

setBottom()

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

setTop()

See also

setRange()

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

setBottom()

See also

setTop()

Parameters
  • bottom (float) –

  • top (float) –

setTop(self, top: float)

Set top range limit

See also

setBottom()

See also

setRange()

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

top(self) float

Returns top range limit

See also

setTop()

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