LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection

This commit is contained in:
Andreas Kling 2022-01-05 17:02:40 +01:00
parent 558fb0a04a
commit c6bcd0dfe4
Notes: sideshowbarker 2024-07-17 21:35:10 +09:00

View file

@ -12,16 +12,8 @@ namespace GUI {
void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter)
{
Vector<ModelIndex> to_remove;
for (auto& index : m_indices) {
if (filter(index))
to_remove.append(index);
}
if (!to_remove.is_empty()) {
for (auto& index : to_remove)
m_indices.remove(index);
if (m_indices.remove_all_matching([&](ModelIndex const& index) { return filter(index); }))
notify_selection_changed();
}
}
void ModelSelection::set(const ModelIndex& index)