QRotaryEncoderSpinBox#

class QInstrument.widgets.QRotaryEncoderSpinBox.QRotaryEncoderSpinBox(*args, colors=None, **kwargs)[source]#

Bases: QWidget

QDoubleSpinBox controlled by a rotary encoder dial.

Combines a QRotaryEncoder dial and a QDoubleSpinBox into a single widget. Turning the dial steps the spinbox value up or down. The spinbox background color interpolates between two colors as the value moves from minimum to maximum.

Parameters:
  • colors (tuple[str, str] | None) – Background color interpolates from colors[0] at minimum to colors[1] at maximum. Accepts any color string recognized by QColor (e.g. 'white', '#68ff00'). Default: ('white', 'red').

  • The following ``QDoubleSpinBox`` methods are delegated

  • directly

  • ``decimals``, ``setDecimals``, ``maximum``, ``minimum``,

  • ``prefix``, ``setPrefix``, ``suffix``, ``setSuffix``,

  • ``singleStep``, ``setSingleStep``, ``stepType``,

  • ``setStepType``, ``value``, ``setValue``, ``valueChanged``.

styleSheetUpdated#

alias of str

sizeHint()[source]#

Return the preferred size for the widget.

Provides a compact default so that the widget does not expand aggressively in parent layouts. The dial scales smoothly to whatever space it is actually allocated.

Return type:

QSize

title()[source]#

Return the title label text.

Return type:

str

setTitle(text)[source]#

Set the title label text displayed above the spinbox.

Parameters:

text (str) – Label text. Pass an empty string to hide the label.

Return type:

None

colors()[source]#

Return the current color pair, or None.

Return type:

tuple[str, str] | None

setColors(colors)[source]#

Set the spinbox background color gradient.

Idempotent: safe to call multiple times with the same or different colors without double-connecting the update slot.

Parameters:

colors (tuple[str, str] | None) – (low_color, high_color) pair, or None to disable color interpolation.

Return type:

None

setMinimum(value)[source]#

Set the spinbox minimum and refresh the background.

Return type:

None

setMaximum(value)[source]#

Set the spinbox maximum and refresh the background.

Return type:

None

setRange(minimum, maximum)[source]#

Set the spinbox range and refresh the background.

Return type:

None

classmethod example()[source]#

Display the widget with laser-power defaults.

Return type:

None