mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-01 04:18:14 +00:00
Add support for invoking an init callback on component and element construction
This enables imperative code to be run. To be used sparingly :-)
This commit is contained in:
parent
9baf6f2bde
commit
907b58161c
20 changed files with 366 additions and 46 deletions
|
|
@ -1312,12 +1312,17 @@ public:
|
|||
inner->data.resize(count);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
auto &c = inner->data[i];
|
||||
bool created = false;
|
||||
if (!c.ptr) {
|
||||
c.ptr = C::create(parent);
|
||||
created = true;
|
||||
}
|
||||
if (c.state == RepeaterInner::State::Dirty) {
|
||||
(*c.ptr)->update_data(i, *m->row_data(i));
|
||||
}
|
||||
if (created) {
|
||||
(*c.ptr)->init();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
inner->data.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue