mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection
This commit is contained in:
parent
558fb0a04a
commit
c6bcd0dfe4
1 changed files with 1 additions and 9 deletions
|
@ -12,16 +12,8 @@ namespace GUI {
|
||||||
|
|
||||||
void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter)
|
void ModelSelection::remove_matching(Function<bool(const ModelIndex&)> filter)
|
||||||
{
|
{
|
||||||
Vector<ModelIndex> to_remove;
|
if (m_indices.remove_all_matching([&](ModelIndex const& index) { return filter(index); }))
|
||||||
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);
|
|
||||||
notify_selection_changed();
|
notify_selection_changed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelSelection::set(const ModelIndex& index)
|
void ModelSelection::set(const ModelIndex& index)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue