1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:15:07 +00:00

LibGUI: Add a ModelSelection::add_all(Vector) API

Using add() is very slow due to the change notifications.
This commit is contained in:
AnotherTest 2020-11-30 09:59:14 +03:30 committed by Andreas Kling
parent b532b2d3ca
commit 169beff21e
2 changed files with 13 additions and 0 deletions

View file

@ -64,6 +64,18 @@ void ModelSelection::add(const ModelIndex& index)
notify_selection_changed();
}
void ModelSelection::add_all(const Vector<ModelIndex>& indices)
{
{
TemporaryChange notify_change { m_disable_notify, true };
for (auto& index : indices)
add(index);
}
if (m_notify_pending)
notify_selection_changed();
}
void ModelSelection::toggle(const ModelIndex& index)
{
ASSERT(index.is_valid());