mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 21:04:47 +00:00
Prepare for the ability to access the model
Add an expression type for the access of the model variable from a repeater
This commit is contained in:
parent
864e74601d
commit
6238d0d14f
8 changed files with 69 additions and 8 deletions
|
@ -87,7 +87,7 @@ struct Model {
|
|||
Model(const Model &) = delete;
|
||||
Model &operator=(const Model &) = delete;
|
||||
virtual int count() const = 0;
|
||||
virtual void *get(int i) const = 0;
|
||||
virtual const void *get(int i) const = 0;
|
||||
};
|
||||
|
||||
template<int Count, typename ModelData>
|
||||
|
@ -96,7 +96,7 @@ struct ArrayModel : Model {
|
|||
int count() const override {
|
||||
return Count;
|
||||
}
|
||||
void *get(int i) {
|
||||
const void *get(int i) {
|
||||
return &data[i];
|
||||
}
|
||||
};
|
||||
|
@ -107,8 +107,8 @@ struct IntModel : Model {
|
|||
int count() const override {
|
||||
return data;
|
||||
}
|
||||
void * get(int) const override {
|
||||
return nullptr;
|
||||
const void *get(int) const override {
|
||||
return &data;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue