# msl.qt.widgets.spinboxes module¶

Custom QtWidgets.QDoubleSpinBox and QtWidgets.QSpinBox classes.

In situations where the value of the spinbox is used to represent the position/value of equipment in the laboratory one typically does not want to connect the valueChanged() signal of the spinbox to change the value of the equipment because each numeric key press would be sent to the equipment. For example, if you wanted to set the position/value of the equipment to 1234 then typing the value 1234 in the spinbox would send:

• 1 $$\rightarrow$$ set the value of the equipment to be 1
• 12 $$\rightarrow$$ set the value of the equipment to be 12
• 123 $$\rightarrow$$ set the value of the equipment to be 123
• 1234 $$\rightarrow$$ set the value of the equipment to be 1234

These custom QAbstractSpinBox subclasses will emit the editingFinished() signal when any of the following events occur:

• the spinbox loses focus
• the Enter key is pressed
• the Up, Down, PageUp or PageDown keys are pressed
• the Increment and Decrement buttons are clicked
class msl.qt.widgets.spinboxes.DoubleSpinBox(*, parent=None, value=0, minimum=0, maximum=100, step=1, decimals=2, use_si_prefix=False, unit='', tooltip='')[source]

Bases: QDoubleSpinBox

A QDoubleSpinBox that emits editingFinished() after a stepBy() signal.

Parameters: parent (QtWidgets.QWidget, optional) – The parent widget. value (float, optional) – The initial value. minimum (float, optional) – The minimum value. maximum (float, optional) – The maximum value. step (float, optional) – The step-by size. decimals (int, optional) – The number of digits after the decimal place to use to show the value. use_si_prefix (bool, optional) – Whether to use an SI prefix to represent the number, e.g. a value of 1.2e-9 would be represented as ‘1.2 n’ unit (str or enum.Enum, optional) – The text to display after the value. tooltip (str, optional) – The tooltip to use for the DoubleSpinBox.
fixup(text)[source]
setValue(value)[source]
textFromValue(value)[source]
validate(text, position)[source]
valueFromText(text)[source]
class msl.qt.widgets.spinboxes.SpinBox(*, parent=None, value=0, minimum=0, maximum=100, step=1, unit='', tooltip='')[source]

Bases: QSpinBox

A QSpinBox that emits editingFinished() after a stepBy() signal.

Parameters: parent (QtWidgets.QWidget, optional) – The parent widget. value (int, optional) – The initial value. minimum (int, optional) – The minimum value. maximum (int, optional) – The maximum value. step (int, optional) – The step-by size. unit (str or enum.Enum, optional) – The text to display after the value. tooltip (str, optional) – The tooltip to use for the SpinBox.