Skip to content

DoubleSpinBox

Base classes

Name Children Inherits
AbstractSpinBoxMixin
prettyqt.widgets.abstractspinbox
QDoubleSpinBox
PySide6.QtWidgets
QDoubleSpinBox(self, /, parent: PySide6.QtWidgets.QWidget | None \= None, *, prefix: str | None \= None, suffix: str | None \= None, cleanText: str | None \= None, decimals: int | None \= None, minimum: float | None \= None, maximum: float | None \= None, singleStep: float | None \= None, stepType: PySide6.QtWidgets.QAbstractSpinBox.StepType | None \= None, value: float | None \= None) -> None

⋔ Inheritance diagram

graph TD
  419547965["widgets.DoubleSpinBox"]
  2425936479["widgets.AbstractSpinBoxMixin"]
  829357528["widgets.WidgetMixin"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  625385617["gui.PaintDeviceMixin"]
  3030722605["QtWidgets.QDoubleSpinBox"]
  1657700966["QtWidgets.QAbstractSpinBox"]
  3620195106["QtWidgets.QWidget"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  673956333["QtGui.QPaintDevice"]
  2425936479 --> 419547965
  829357528 --> 2425936479
  3227531497 --> 829357528
  2751680898 --> 3227531497
  625385617 --> 829357528
  2751680898 --> 625385617
  2751680898 --> 829357528
  2751680898 --> 2425936479
  3030722605 --> 419547965
  1657700966 --> 3030722605
  3620195106 --> 1657700966
  3984060476 --> 3620195106
  37984305 --> 3984060476
  2751680898 --> 37984305
  673956333 --> 3620195106
  37984305 --> 673956333

🛈 DocStrings

Bases: AbstractSpinBoxMixin, QDoubleSpinBox

Spin box widget that takes doubles.

Source code in prettyqt/widgets/doublespinbox.py
class DoubleSpinBox(widgets.AbstractSpinBoxMixin, widgets.QDoubleSpinBox):
    """Spin box widget that takes doubles."""

    value_changed = core.Signal(float)

    def __init__(self, *args, maximum: float = float("inf"), **kwargs):
        super().__init__(*args, maximum=maximum, **kwargs)
        self.valueChanged.connect(self.value_changed)

    @classmethod
    def supports(cls, instance) -> bool:
        return isinstance(instance, float)

    def set_range(self, start: float | None, end: float | None):
        self.set_minimum(start)
        self.set_maximum(end)

    setRange = set_range  # noqa: N815

    def set_minimum(self, value: float | None):
        if value is None:
            value = -float("inf")
        super().setMinimum(value)

    setMinimum = set_minimum  # noqa: N815

    def set_maximum(self, value: float | None):
        if value is None:
            value = float("inf")
        super().setMaximum(value)

    setMaximum = set_maximum  # noqa: N815

:fa-brands-github: Show source on GitHub