Template Class VectorModel

Inheritance Relationships

Base Type

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 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 push_back(const ModelData &value)

Append a new row with the given value.

inline void erase(int 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.