mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 21:04:47 +00:00
Support for array model in C++
This commit is contained in:
parent
6238d0d14f
commit
022cd64625
2 changed files with 45 additions and 5 deletions
|
@ -93,10 +93,13 @@ struct Model {
|
|||
template<int Count, typename ModelData>
|
||||
struct ArrayModel : Model {
|
||||
std::array<ModelData, Count> data;
|
||||
template<typename... A>ArrayModel(A &&...a)
|
||||
: data{std::forward<A>(a)...} {}
|
||||
ArrayModel(int x) {}
|
||||
int count() const override {
|
||||
return Count;
|
||||
}
|
||||
const void *get(int i) {
|
||||
const void *get(int i) const override {
|
||||
return &data[i];
|
||||
}
|
||||
};
|
||||
|
@ -137,3 +140,4 @@ struct Repeater {
|
|||
|
||||
|
||||
} // namespace sixtyfps
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue