mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00: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
1 changed files with 8 additions and 4 deletions
|
@ -34,6 +34,7 @@ public:
|
||||||
}
|
}
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
||||||
{
|
{
|
||||||
auto& cursor = m_cursors[index.row()];
|
auto& cursor = m_cursors[index.row()];
|
||||||
|
@ -51,7 +52,8 @@ public:
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
virtual void update()
|
|
||||||
|
virtual void invalidate() override
|
||||||
{
|
{
|
||||||
m_cursors.clear();
|
m_cursors.clear();
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ public:
|
||||||
m_cursors.append(move(cursor));
|
m_cursors.append(move(cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
did_update();
|
Model::invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -110,6 +112,7 @@ public:
|
||||||
}
|
}
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override
|
||||||
{
|
{
|
||||||
auto& icon_set = m_icon_sets[index.row()];
|
auto& icon_set = m_icon_sets[index.row()];
|
||||||
|
@ -131,7 +134,8 @@ public:
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
virtual void update()
|
|
||||||
|
virtual void invalidate() override
|
||||||
{
|
{
|
||||||
m_icon_sets.clear();
|
m_icon_sets.clear();
|
||||||
|
|
||||||
|
@ -171,7 +175,7 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
did_update();
|
Model::invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue