Class: QgsDoubleSpinBox

The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.

The clear value can be either the minimum or the maiximum value of the spin box or a custom value.

This value can then be handled by a special value text.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsDoubleSpinBox

Base classes

QDoubleSpinBox

QAbstractSpinBox

QWidget

QObject

QPaintDevice

class qgis.gui.QgsDoubleSpinBox[source]

Bases: QDoubleSpinBox

__init__(parent: QWidget | None = None)

Constructor for QgsDoubleSpinBox.

Parameters:

parent (Optional[QWidget] = None) – parent widget

class ClearValueMode

Bases: int

CustomValue = 2
MaximumValue = 1
MinimumValue = 0
virtual clear(self)[source]

Sets the current value to the value defined by the clear value.

clearValue(self) float[source]

Returns the value used when clear() is called.

See also

setClearValue()

Return type:

float

signal editingTimeout[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

editingTimeoutInterval(self) int[source]

Returns the timeout (in milliseconds) threshold for the editingTimeout() signal to be emitted after an edit.

Added in version 3.42.

Return type:

int

expressionsEnabled(self) bool[source]

Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.

Return type:

bool

Returns:

True if spin box allows expression entry

isCleared(self) bool[source]

Returns True if the value is equal to the clear value.

See also

clearValue()

Added in version 3.42.

Return type:

bool

signal returnPressed[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

setClearValue(self, customValue: float, clearValueText: str | None = '')[source]

Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.

Parameters:
  • customValue (float) – defines the numerical value used as the clear value

  • clearValueText (Optional[str] = '') – is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.

See also

clearValue()

setClearValueMode(self, mode: QgsDoubleSpinBox.ClearValueMode, clearValueText: str | None = '')[source]

Defines if the clear value should be the minimum or maximum values of the widget or a custom value.

Parameters:
  • mode (QgsDoubleSpinBox.ClearValueMode) – mode to user for clear value

  • clearValueText (Optional[str] = '') – is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.

setEditingTimeoutInterval(self, timeout: int)[source]

Sets the timeout (in milliseconds) threshold for the editingTimeout() signal to be emitted after an edit.

See also

editingTimeout()

Added in version 3.42.

Parameters:

timeout (int)

setExpressionsEnabled(self, enabled: bool)[source]

Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.

Parameters:

enabled (bool) – set to True to allow expression entry

setLineEditAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)[source]

Set alignment in the embedded line edit widget

Parameters:

alignment (Union[Qt.Alignment, Qt.AlignmentFlag])

setShowClearButton(self, showClearButton: bool)[source]

Sets whether the widget will show a clear button. The clear button allows users to reset the widget to a default or empty state.

Parameters:

showClearButton (bool) – set to True to show the clear button, or False to hide it

setSpecialValueText(self, txt: str | None)[source]

Set the special-value text to be txt If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minimum(). Typical use is to indicate that this choice has a special (default) meaning.

Parameters:

txt (Optional[str])

showClearButton(self) bool[source]

Returns whether the widget is showing a clear button.

Return type:

bool

signal textEdited[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.