Open hunger opened 8 months ago
This would improve on the InputType
hack in #3356.
Since these use cases are often associated with specific data types that one would want to two-way-bind to, I believe dedicated widgets would be more appropriate. I talked about IntEdit
and FloatEdit
here.
In my app, I implemented a rudimentary version of a DurationEdit
with an in-out property <duration> value
. It allows for colon-separated integers with up to two colons. Values >= a day are represented using an hour value >= 24.
My widget also has an out property <string> unit
that you can bind to to display the appropriate SI (or SI-near) unit to the right of the widget (i.e., s, min, or h). This is the unit of the leftmost number.
I want to recommend that a DurationEdit
should be one of the dedicated text input widgets.
duration
type supports.duration
s. A possible use case that comes to mind would be the synchronization-related audio delay/advancement in the context of video.0
. For the maximum, or when needing negative durations, something simlar to Rust's type constants like duration::MIN
and duration::MAX
would be needed. The defaults should be: minimum 0
, maximum duration::MAX
.
We should have a simple way to have common input validation on input.
Common things like "number", "float", "time" and maybe something pattern-based would be nice to have.
Currently you can work around this using the
edited()
andaccepted()
callbacks, but that is not very convenient nor designer-friendly.(Originate from https://github.com/slint-ui/slint/discussions/4154)