LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection
This commit is contained in:
parent
558fb0a04a
commit
c6bcd0dfe4
Notes:
sideshowbarker
2024-07-17 21:35:10 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c6bcd0dfe48
1 changed files with 1 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue