Template Class VectorModel#
Defined in File slint.h
Inheritance Relationships#
Base Type#
public slint::Model< ModelData >
(Template Class Model)
Class Documentation#
-
template<typename ModelData>
class VectorModel : public slint::Model<ModelData># A Model backed by a SharedVector.
Public Functions
-
VectorModel() = default#
Constructs a new empty VectorModel.
-
inline VectorModel(std::vector<ModelData> array)#
Constructs a new VectorModel from array.
-
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 erase(size_t index)#
Remove the row at the given index from the model.
-
inline void insert(size_t index, const ModelData &value)#
Inserts the given value as a new row at the specified index.
-
inline void clear()#
Erases all rows from the VectorModel.
-
inline void set_vector(std::vector<ModelData> array)#
Replaces the underlying VectorModel’s vector with array.
-
VectorModel() = default#