You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a ListView displaying some items of a model. Now I want a filter feature where the user can just start typing, while the filter term is somehow displayed in the UI (could be a LineEdit, or just a Text).
I think it would be possible with a FocusScope and its key-pressed callback forwarding the event to the native backend and everything is done in the backend. However, it would be nice if the input related part of this feature could be implemented in pure Slint, and only the filtering done in the backend (as the model comes from there anyway). This would allow testing the UI related part in the preview rather than in the compiled application.
The problem here is that the KeyEvent is a bit too low level for this purpose. For example, any special keys (like Shift or Ctrl) need to be filtered out. And the backspace would need to remove the last character from the search term, but I don't see a way to do that in Slint.
Somehow I want just a LineEdit (or TextInput), but with a custom FocusScope rather than the edit's focus scope.
Or, I want the key event handling of a TextInput without actually requiring the TextInput itself. If the TextInput had a invoke-key-press() function, I could just forward the event from my FocusScope and read back the property TextInput.text. Whether I actually display the TextInput in the UI or not is not relevant.
One could also consider a built-in filter-term property on ListView where ListView does all the input handling. Possibly with a filter-delay property to delay the actual (possibly expensive) filtering while typing.
So I'm not sure what would be a good way to implement my use-case. Maybe there are some good ideas out there? Or do you think this is nothing which Slint should support, i.e. needs to be implemented in the native backend ? I just think filtering list views by keyboard is a standard UI feature found in many desktop applications. (another common use-case is jumping to a list view item by keyboard input, rather than filtering)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a
ListView
displaying some items of a model. Now I want a filter feature where the user can just start typing, while the filter term is somehow displayed in the UI (could be aLineEdit
, or just a Text).I think it would be possible with a
FocusScope
and itskey-pressed
callback forwarding the event to the native backend and everything is done in the backend. However, it would be nice if the input related part of this feature could be implemented in pure Slint, and only the filtering done in the backend (as the model comes from there anyway). This would allow testing the UI related part in the preview rather than in the compiled application.It seems almost doable already, but not to 100%:
The problem here is that the
KeyEvent
is a bit too low level for this purpose. For example, any special keys (like Shift or Ctrl) need to be filtered out. And the backspace would need to remove the last character from the search term, but I don't see a way to do that in Slint.Somehow I want just a
LineEdit
(orTextInput
), but with a customFocusScope
rather than the edit's focus scope.Or, I want the key event handling of a
TextInput
without actually requiring theTextInput
itself. If theTextInput
had ainvoke-key-press()
function, I could just forward the event from myFocusScope
and read back the propertyTextInput.text
. Whether I actually display theTextInput
in the UI or not is not relevant.One could also consider a built-in
filter-term
property onListView
whereListView
does all the input handling. Possibly with afilter-delay
property to delay the actual (possibly expensive) filtering while typing.So I'm not sure what would be a good way to implement my use-case. Maybe there are some good ideas out there? Or do you think this is nothing which Slint should support, i.e. needs to be implemented in the native backend ? I just think filtering list views by keyboard is a standard UI feature found in many desktop applications. (another common use-case is jumping to a list view item by keyboard input, rather than filtering)
Beta Was this translation helpful? Give feedback.
All reactions