slint
slint copied to clipboard
Add `VecModel::splice` or `VecModel::extend`
After examining internal/core/model)/adapters.rs and the todo example, I noticed the gui allows to insert one item at a time which may be tedious and may render the gui less performant when adding many items.
As a change request, please add the capability to import a text file of todo items, in a sense of range of new items or a slice. and add this range before or after a specified index position in the model.
As a reference, there is extend_from_slice which adds a range of items after the last index position. https://doc.rust-lang.org/std/vec/struct.Vec.html#method.extend_from_slice
But it would be handy to have something that allows to add a range anywhere in the list without triggering gui events for all of these actions as they are added, but only trigger gui events after they are all added. It would enhance the gui for very large lists or spreadsheets for example.
I believe another capability similar to this, but for removing a range, without updating the gui until all removed would be more performant as well.
I really appreciate the todo example because in a sense with the checked items provides the similar capabilities as a multi-selection list box. The above change requests I believe would help such capabilities to provide performant and responsive gui.
Thank you for listening.
The underlying datastructure (the Model) support adding many element at the same time, (via ModelNotify https://docs.rs/slint/0.3.0/slint/struct.ModelNotify.html )
The Todo example uses VecModel
which indeed doesn't have this capabilities.
I believe what you are asking for is adding an extent_from_slice
or splice
functions to VecModel
, is that right?
That shouldn't be too difficult to do.