Skip to content

DoubleValidator

Qt Base Class: QDoubleValidator

Signature: QDoubleValidator(self, bottom: float, top: float, decimals: int, parent: Optional[PySide6.QtCore.QObject] = None) -> None QDoubleValidator(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
ValidatorMixin
prettyqt.gui.validator
QDoubleValidator
PySide6.QtGui
QDoubleValidator(self, bottom: float, top: float, decimals: int, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473245595328["gui.DoubleValidator"]
  1473245536768["gui.ValidatorMixin"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473289214448["QtGui.QDoubleValidator"]
  1473289208592["QtGui.QValidator"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473245536768 --> 1473245595328
  1473299815024 --> 1473245536768
  140713234304496 --> 1473299815024
  1473289214448 --> 1473245595328
  1473289208592 --> 1473289214448
  1473288842240 --> 1473289208592
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ValidatorMixin, QDoubleValidator

Range checking of floating-point numbers.

Source code in prettyqt\gui\doublevalidator.py
class DoubleValidator(gui.ValidatorMixin, gui.QDoubleValidator):
    """Range checking of floating-point numbers."""

    ID = "double"

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLocale(core.Locale("en-En"))

    def __repr__(self):
        return get_repr(self, self.bottom(), self.top(), self.decimals())

    def __reduce__(self):
        return type(self), (self.bottom(), self.top(), self.decimals()), None

    def __eq__(self, other: object):
        return (
            (
                self.bottom() == other.bottom()
                and self.top() == other.top()
                and self.decimals() == other.decimals()
            )
            if isinstance(other, type(self))
            else False
        )

    def set_range(
        self, start: float | None, end: float | None, decimals: int | None = None
    ):
        if decimals is None:
            decimals = -1
        if start is None:
            start = -float("inf")
        if end is None:
            end = float("inf")
        self.setRange(start, end, decimals)

⌗ Property table

Qt Property Type Doc
objectName QString
bottom double
top double
decimals int
notation QDoubleValidator::Notation