mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
Only re-create elements if the model actually changed
Being dirty is not enough Fixes #7245 ChangeLog: Elements of a `for` now only get re-created if the model is changed, not if it is only dirty
This commit is contained in:
parent
4da2cb4471
commit
87d86ae7d2
6 changed files with 116 additions and 12 deletions
|
@ -1146,10 +1146,14 @@ public:
|
|||
void ensure_updated(const Parent *parent) const
|
||||
{
|
||||
if (model.is_dirty()) {
|
||||
inner = std::make_shared<RepeaterInner>();
|
||||
if (auto m = model.get()) {
|
||||
inner->model = m;
|
||||
m->attach_peer(inner);
|
||||
auto old_model = model.get_internal();
|
||||
auto m = model.get();
|
||||
if (!inner || old_model != m) {
|
||||
inner = std::make_shared<RepeaterInner>();
|
||||
if (m) {
|
||||
inner->model = m;
|
||||
m->attach_peer(inner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,6 +184,8 @@ struct Property
|
|||
{
|
||||
}
|
||||
|
||||
const T &get_internal() const { return value; }
|
||||
|
||||
private:
|
||||
cbindgen_private::PropertyHandleOpaque inner;
|
||||
mutable T value {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue