Template Class Model#
Defined in File slint.h
Inheritance Relationships#
Derived Types#
public slint::FilterModel< ModelData >
(Template Class FilterModel)public slint::SortModel< ModelData >
(Template Class SortModel)public slint::VectorModel< ModelData >
(Template Class VectorModel)
Class Documentation#
-
template<typename ModelData>
class Model# A Model is providing Data for `for - in<../../slint/src/reference/repetitions.html>`_ repetitions or `ListView<../../slint/src/builtins/widgets.html#listview>`_ elements of the
.slint
languageSubclassed by slint::FilterModel< ModelData >, slint::SortModel< ModelData >, slint::VectorModel< ModelData >
Public Functions
-
virtual ~Model() = default#
-
Model() = default#
-
virtual size_t row_count() const = 0#
The amount of row in the model.
-
virtual std::optional<ModelData> row_data(size_t i) const = 0#
Returns the data for a particular row. This function should be called with
row < row_count()
.
-
inline virtual void set_row_data(size_t, const ModelData&)#
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
Protected Functions
-
inline void row_changed(size_t row)#
Notify the views that a specific row was changed.
-
inline void row_added(size_t index, size_t count)#
Notify the views that rows were added.
-
inline void row_removed(size_t index, size_t count)#
Notify the views that rows were removed.
-
inline void reset()#
Notify the views that the model has been changed and that everything needs to be reloaded.
-
virtual ~Model() = default#