Template Class SortModelο
Defined in File slint.h
Inheritance Relationshipsο
Base Typeο
public slint::Model< ModelData >
(Template Class Model)
Class Documentationο
-
template<typename ModelData>
class SortModel : public slint::Model<ModelData>ο The SortModel acts as an adapter model for a given source model by sorting all rows with by order provided by the given sorting function. The sorting function is called for pairs of elements of the source model.
Public Functions
Constructs a new SortModel that provides a sorted view on the source_model by applying the order given by the specified comp.
-
inline virtual int row_count() const overrideο
The amount of row in the model.
-
inline virtual std::optional<ModelData> row_data(int i) const overrideο
Returns the data for a particular row. This function should be called with
row < row_count()
.
-
inline virtual void set_row_data(int i, const ModelData &value) overrideο
Sets the data for a particular row.
This function should only be called with
row < row_count()
.If the model cannot support data changes, then it is ok to do nothing. The default implementation will print a warning to stderr.
If the model can update the data, it should also call
row_changed
-
inline void reset()ο
Re-applies the modelβs sort function on each row of the source model. Use this if state external to the sort function has changed.
-
inline int unsorted_row(int sorted_row_index) constο
Given the sorted_row_index, this function returns the corresponding row index in the source model.
Friends
- friend struct private_api::SortModelInner< ModelData >