summaryrefslogtreecommitdiff
path: root/Userland/Demos/WidgetGallery/GalleryModels.h
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2021-08-08 12:35:20 +0000
committerAndreas Kling <kling@serenityos.org>2021-08-08 14:45:23 +0200
commit07f5e12568712f2a96f63037463967c00dfc4d04 (patch)
tree35727af496f6cf883c6b62f5924f007655327bad /Userland/Demos/WidgetGallery/GalleryModels.h
parent2be368e4c44fdd0a096738b4ac48174cd1872e50 (diff)
downloadserenity-07f5e12568712f2a96f63037463967c00dfc4d04.zip
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.
Diffstat (limited to 'Userland/Demos/WidgetGallery/GalleryModels.h')
-rw-r--r--Userland/Demos/WidgetGallery/GalleryModels.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h
index 85069ab3bc..a193beb073 100644
--- a/Userland/Demos/WidgetGallery/GalleryModels.h
+++ b/Userland/Demos/WidgetGallery/GalleryModels.h
@@ -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: