Skip to main content

Module mask

Module mask 

Source
Expand description

Input-mask grammar (Qt-compatible subset).

Adopts the well-known QLineEdit::setInputMask grammar so masks that work in any Qt-based desktop app port over verbatim. Used by TextInputField to constrain typed input, render the empty-state template (__/__/____ for 99/99/9999), and auto-insert literal separators between editable positions.

§Grammar

CharMeaning
9Required digit
0Optional digit
ARequired ASCII letter
aOptional ASCII letter
NRequired alphanumeric
nOptional alphanumeric
XAny required character
xAny optional character
HRequired hex digit
hOptional hex digit
>Uppercase the following editable chars (toggle)
<Lowercase the following editable chars (toggle)
!Cancel the case lock from > / <
\XLiteral X (escape)

Anything else is a fixed separator: 99/99/9999, (999) 999-9999, >AA for force-uppercase 2-letter codes.

§Storage model

The bound Signal<String> observes the formatted text including literal separators (matches Qt’s QLineEdit semantics): typing 12302026 into 99/99/9999 produces "12/30/2026", not "12302026". Apps that need raw digits strip separators trivially with .replace('/', "").

Structs§

FormattedMask
Result of InputMask::format: the fully-templated string plus metadata about how much of the user’s input was consumed.
InputMask
Parsed mask: a sequence of positions, ready for rendering and per-character routing.

Enums§

CaseLock
Per-position case lock applied during typing.
MaskClass
Character classes that an editable position accepts.
MaskError
Mask-parse errors. Currently only the trailing-backslash case; any other character becomes a fixed literal (Qt’s permissive behaviour) so most accidental “weird” masks just produce odd templates rather than parse failures.
MaskPosition
One position in the parsed mask. Either the user provides a character there (Editable) or it’s a fixed literal that the field paints automatically and the caret skips over.