slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.65k stars 608 forks source link

`accepted` callback should trigger when losing focus (incl. on window deactivation) #5930

Open Enyium opened 3 months ago

Enyium commented 3 months ago

As it stands - the accepted callback of a number of elements and widgets exclusively being triggered by pressing Enter - I find the callback quite useless. In my view, it should be a less often triggered alternative to edited, but one that will eventually always be triggered, like released on Slider (edited is parallel to Slider's changed).

ogoffart commented 2 months ago

Thanks for filing an issue. I agree that accepted is badly named. We can't change accepted, that would be a breaking change. What we can do is deprecate it and rename it to return-pressed. (We have infrastructure to do that in TextInput because it's builtin, but we don't have infrastructure to do that yet for component declared in the Slint language.)

Regardless, it does make sense to add a editing-finished callback to TextInput/LineEdit/TextEdit.