slint icon indicating copy to clipboard operation
slint copied to clipboard

MapModel is missing set_row_data() function

Open aamer-shaikh opened this issue 1 year ago • 1 comments
trafficstars

The C++ classes of SortModel, FilterModel, VectorModel, all have set_row_data() implemented. However, MapModel is missing the same.

So if we try to update any item from UI, we get the warning - Model::set_row_data was called on a read-only model

aamer-shaikh avatar May 23 '24 07:05 aamer-shaikh

This is not possible with the current API. Suppose that you have a map model that converts from your own C++ data structure Foo to a slint_interpreter::Value: If set_row_data is called with a slint_interpreter::Value, MapModel canot know how to convert it back to Foo.

So this would require new API where the user also provides a function that maps the other way around, a bi-directional map model.

tronical avatar May 23 '24 07:05 tronical