mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Rename C++'s internal AbstractRepeaterView to ModelChangeListener
For consistency with the Rust model implementation.
This commit is contained in:
parent
5b95466fa6
commit
56983482b9
3 changed files with 8 additions and 8 deletions
|
@ -595,15 +595,15 @@ inline float layout_cache_access(const SharedVector<float> &cache, int offset, i
|
|||
}
|
||||
|
||||
// models
|
||||
struct AbstractRepeaterView
|
||||
struct ModelChangeListener
|
||||
{
|
||||
virtual ~AbstractRepeaterView() = default;
|
||||
virtual ~ModelChangeListener() = default;
|
||||
virtual void row_added(int index, int count) = 0;
|
||||
virtual void row_removed(int index, int count) = 0;
|
||||
virtual void row_changed(int index) = 0;
|
||||
virtual void reset() = 0;
|
||||
};
|
||||
using ModelPeer = std::weak_ptr<AbstractRepeaterView>;
|
||||
using ModelPeer = std::weak_ptr<ModelChangeListener>;
|
||||
|
||||
template<typename M>
|
||||
auto access_array_index(const M &model, int index)
|
||||
|
@ -834,7 +834,7 @@ class FilterModel;
|
|||
|
||||
namespace private_api {
|
||||
template<typename ModelData>
|
||||
struct FilterModelInner : private_api::AbstractRepeaterView
|
||||
struct FilterModelInner : private_api::ModelChangeListener
|
||||
{
|
||||
FilterModelInner(std::shared_ptr<slint::Model<ModelData>> source_model,
|
||||
std::function<bool(const ModelData &)> filter_fn,
|
||||
|
@ -989,7 +989,7 @@ class Repeater
|
|||
{
|
||||
private_api::Property<std::shared_ptr<Model<ModelData>>> model;
|
||||
|
||||
struct RepeaterInner : AbstractRepeaterView
|
||||
struct RepeaterInner : ModelChangeListener
|
||||
{
|
||||
enum class State { Clean, Dirty };
|
||||
struct ComponentWithState
|
||||
|
|
|
@ -436,13 +436,13 @@ inline Value::Value(const std::shared_ptr<slint::Model<Value>> &model)
|
|||
{
|
||||
using cbindgen_private::ModelAdaptorVTable;
|
||||
using vtable::VRef;
|
||||
struct ModelWrapper : private_api::AbstractRepeaterView
|
||||
struct ModelWrapper : private_api::ModelChangeListener
|
||||
{
|
||||
std::shared_ptr<slint::Model<Value>> model;
|
||||
cbindgen_private::ModelNotifyOpaque notify;
|
||||
// This kind of mean that the rust code has ownership of "this" until the drop function is
|
||||
// called
|
||||
std::shared_ptr<AbstractRepeaterView> self;
|
||||
std::shared_ptr<ModelChangeListener> self;
|
||||
~ModelWrapper() { cbindgen_private::slint_interpreter_model_notify_destructor(¬ify); }
|
||||
|
||||
void row_added(int index, int count) override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue