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 size_t row_count() const override¶
The amount of row in the model.
-
inline virtual std::optional<ModelData> row_data(size_t 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(size_t 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 >