Template Class FilterModelο
Defined in File slint.h
Inheritance Relationshipsο
Base Typeο
public slint::Model< ModelData >
(Template Class Model)
Class Documentationο
-
template<typename ModelData>
class FilterModel : public slint::Model<ModelData>ο The FilterModel acts as an adapter model for a given source model by applying a filter function. The filter function is called for each row on the source model and if the filter accepts the row (i.e. returns true), the row is also visible in the FilterModel.
Public Functions
Constructs a new FilterModel that provides a limited view on the source_model by applying filter_fn on each row. If the provided function returns true, the row is exposed by the FilterModel.
-
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 filter function on each row of the source model. Use this if state external to the filter function has changed.
-
inline int unfiltered_row(int filtered_row) constο
Given the filtered_row index, this function returns the corresponding row index in the source model.
Friends
- friend struct private_api::FilterModelInner< ModelData >