Template Class ReverseModel#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename ModelData>
class ReverseModel : public slint::Model<ModelData>#

The ReverseModel acts as an adapter model for a given source model by reserving all rows. This means that the first row in the source model is the last row of this model, the second row is the second last, and so on.

Public Functions

inline ReverseModel(std::shared_ptr<Model<ModelData>> source_model)#

Constructs a new ReverseModel that provides a reversed view on the source_model.

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 std::shared_ptr<Model<ModelData>> source_model() const#

Returns the source model of this reserve model.


friend struct private_api::ReverseModelInner< ModelData >