edifice.SpinInput#
- class edifice.SpinInput(value=0, min_value=0, max_value=100, on_change=None, value_to_text=None, text_to_value=None, enable_mouse_scroll=True, **kwargs)[source]#
Bases:
QtWidgetElement
Widget for a
int
input value with up/down buttons.Allows the user to choose a value by 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
- 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
],Optional
[Awaitable
[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>
],Literal
[<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
int
value if the text is valid.QValidator.State.Intermediate
if the text might be valid with more input.QValidator.State.Invalid
if the text is invalid.
See QValidator.State.
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
Reference
to this Element.set_key
(key)Sets the key of the Element.
Attributes
children
The children of this Element.
props
The props of this Element.
underlying
The underlying QWidget, which may not exist if this Element has not rendered.