edifice.SpinInput#
- class edifice.SpinInput(value=0, min_value=0, max_value=100, on_change=None, value_to_text=None, text_to_value=None, single_step=1, enable_mouse_scroll=True, **kwargs)[source]#
Bases:
QtWidgetElement[EdSpinBox]Widget for a
intinput value with up/down buttons.Allows the user to choose an
intby clicking the up/down buttons or pressing up/down on the keyboard to increase/decrease the value currently displayed. The user can also type the value in manually.Underlying Qt Widget QSpinBox
Props
All props for
QtWidgetElementplus:- Parameters:
value (
int) – Value of the text input.min_value (
int) – Minimum value of the text input.max_value (
int) – Maximum value of the text input.on_change (
Optional[Callable[[int],None]]) – Callback for when the value changes. The callback is passed the changed value.value_to_text (
Optional[Callable[[int],str]]) – Function to convert the value to a text. If not provided, the default text conversion is used.text_to_value (
Optional[Callable[[str],Union[int,Literal[<State.Intermediate: 1>,<State.Invalid: 0>]]]]) –Function to convert the text to a value. If not provided, the default text conversion is used.
The function should return one of
intvalue if the text is valid.QValidator.State.Intermediateif the text might be valid with more input.QValidator.State.Invalidif the text is invalid.
See QValidator.State.
(At the time of this writing, the PySide6.QValidator.State Enum cannot be correctly typechecked as a Literal by Pyright for some reason.)
single_step (
int) – The value step size for the up/down buttons.enable_mouse_scroll (
bool) – Whether mouse scroll events should be able to change the value.
Methods
__init__([value, min_value, max_value, ...])register_ref(reference)Registers provided
Referenceto this Element.set_key(key)Set the key of an
Element.Attributes
childrenThe children of this Element.
propsThe props of this Element.
underlyingThe underlying QWidget, which may not exist if this Element has not rendered.