slint
slint copied to clipboard
TextInput: add API to get and set the selection
We should add an API in TextInput (and forward it in LineEdit and TextEdit) to get or set the selection positions
Discussed in https://github.com/slint-ui/slint/discussions/3899
What if we added a get-selected-text()
function? That would be straightforward to implement and there’d be no expectation about re-evaluation of the selection changes z
if it have this:
VerticalLayout {
foo := LineEdit {}
Text { text: foo.get-selected-text(); }
}
I'd expect the text to change when the selection is changed. (this is trivial to implement)
API-wise, i'd probably name it just selected-text
and i wonder if it shouldn't be a read-only property.
The setter part was implemented in #4164, but there's no getter yet.