mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 01:59:14 +03:00
WidgetGallery: Change model update() functions to invalidate()
These functions reload the whole model contents and thus can be moved to invalidate(), which saves us from the need to manually call update() on them.
This commit is contained in:
parent
2be368e4c4
commit
07f5e12568
Notes:
sideshowbarker
2024-07-18 07:14:00 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/07f5e125687 Pull-request: https://github.com/SerenityOS/serenity/pull/9285
@ -34,6 +34,7 @@ public:
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
||||
{
|
||||
auto& cursor = m_cursors[index.row()];
|
||||
@ -51,7 +52,8 @@ public:
|
||||
}
|
||||
return {};
|
||||
}
|
||||
virtual void update()
|
||||
|
||||
virtual void invalidate() override
|
||||
{
|
||||
m_cursors.clear();
|
||||
|
||||
@ -69,7 +71,7 @@ public:
|
||||
m_cursors.append(move(cursor));
|
||||
}
|
||||
|
||||
did_update();
|
||||
Model::invalidate();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -110,6 +112,7 @@ public:
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
||||
{
|
||||
auto& icon_set = m_icon_sets[index.row()];
|
||||
@ -131,7 +134,8 @@ public:
|
||||
}
|
||||
return {};
|
||||
}
|
||||
virtual void update()
|
||||
|
||||
virtual void invalidate() override
|
||||
{
|
||||
m_icon_sets.clear();
|
||||
|
||||
@ -171,7 +175,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
did_update();
|
||||
Model::invalidate();
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user