pub struct NumberInput { /* private fields */ }Expand description
A field for a whole number, with buttons that step it up and down, as
the platform’s spin box shows it. Its label is its accessible name; show
one beside it with a Text. Typing reports the number when the edit is
done (Return, or leaving the field), as each platform commits one.
Whole numbers in an i32, because Qt’s spin box holds an int.
let memory = signal(64);
NumberInput::new("Memory (MB)").range(16, 512).step(16).bind(memory)Implementations§
Source§impl NumberInput
impl NumberInput
Sourcepub fn new(label: impl IntoValue<String>) -> NumberInput
pub fn new(label: impl IntoValue<String>) -> NumberInput
From 0 to 100, at 0.
Sourcepub fn label(self, label: impl IntoValue<String>) -> NumberInput
pub fn label(self, label: impl IntoValue<String>) -> NumberInput
Its label: the accessible name, which new takes. In view!,
<NumberInput label="…"/>.
pub fn range(self, min: i32, max: i32) -> NumberInput
Sourcepub fn range_with(self, range: impl IntoValue<(i32, i32)>) -> NumberInput
pub fn range_with(self, range: impl IntoValue<(i32, i32)>) -> NumberInput
A range that changes: (min, max).
Sourcepub fn step(self, step: impl IntoValue<i32>) -> NumberInput
pub fn step(self, step: impl IntoValue<i32>) -> NumberInput
What the buttons and arrow keys add or take away. Without one, the platform’s default (1 on every platform).
Sourcepub fn wrap_around(self, wrap: impl IntoValue<bool>) -> NumberInput
pub fn wrap_around(self, wrap: impl IntoValue<bool>) -> NumberInput
Stepped past one end of its range, it goes on from the other. Without, it’s the platform’s: AppKit’s stepper wraps round, the other platforms’ spin boxes stop.
pub fn value(self, value: impl IntoValue<i32>) -> NumberInput
Sourcepub fn bind(self, signal: Signal<i32>) -> NumberInput
pub fn bind(self, signal: Signal<i32>) -> NumberInput
Two-way binding, Vue’s v-model.
pub fn enabled(self, enabled: impl IntoValue<bool>) -> NumberInput
Sourcepub fn native(self, tweak: Tweak<NumberInput>) -> NumberInput
pub fn native(self, tweak: Tweak<NumberInput>) -> NumberInput
Raw platform settings, past the semantic ones: see Tweak.
Sourcepub fn on_change(self, handler: impl Fn(i32) + 'static) -> NumberInput
pub fn on_change(self, handler: impl Fn(i32) + 'static) -> NumberInput
Called with the new number when the user steps it or finishes typing one.
Trait Implementations§
Source§impl ElementBuilder for NumberInput
impl ElementBuilder for NumberInput
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.