Skip to main content

Module time_edit

Module time_edit 

Source
Expand description

TimeEdit — text input for time-of-day, bound to Signal<Option<Time>>.

Single-line editable time field with strftime-pattern parse/format and optional 12h/24h mode + AM/PM. Same compositional pattern as DateEdit (TextInputField + commit on Enter/blur + step keys), without a popover (desktop convention is no graphical time picker).

§Behaviour

  • Value binding: Signal<Option<Time>> — None shows the placeholder.
  • Pattern: 24h default %H:%M; 12h is %I:%M %p. Override via format_pattern. Add seconds with seconds(SecondsMode::Editable).
  • Keyboard (preview-pass on the wrapper): the step is segment-relative — it moves the field under the caret (hour, minute, second or AM/PM), which is what QDateTimeEdit does.
    • Arrow Up / Down → ±1 unit of that segment; Shift+ → ±10.
    • PageUp / PageDown → ±10 units; Shift+ → ±100.
    • Hours wrap within the day and minutes and seconds within the hour and minute, so a sweep never rolls the value over.

§Accessibility

  • Container — Role::TimeInput with set_value formatted as HH:MM:SS and set_label from .label().
  • Underlying TextInputField keeps Role::TextInput so AT knows it’s editable. It is where focus lands, so it carries the same name (the .label(), or “Time”), and it is the composite’s accessibility_proxy: what an application gives the TimeEdit (access_label, access_described_by) lands on the field. As on DateEdit, the field’s own name is read before a labelled_by relation, so name a time field in a form with .label().
ⓘ
use teksilo_core::signal::Signal;
use teksilo_widgets::time_edit::{TimeEdit, TimeFormat, SecondsMode};

let value = Signal::new(None);
let _field = TimeEdit::new(value)
    .format(TimeFormat::Hour24)
    .seconds(SecondsMode::Hidden);

§Touch and pen

See DateEdit’s “Touch and pen” section: the whole date/time family carries focus_within and on_key_preview only, and its pointer surface is the embedded field, the trigger button and the popover.

Structs§

TimeEdit
Single-line editable time-of-day field.

Enums§

SecondsMode
Whether the seconds segment is shown in TimeEdit.
TimeFormat
12h vs 24h time formatting.