diff --git a/Libraries/LibGUI/ModelSelection.cpp b/Libraries/LibGUI/ModelSelection.cpp index 5b4d208883..2a22336855 100644 --- a/Libraries/LibGUI/ModelSelection.cpp +++ b/Libraries/LibGUI/ModelSelection.cpp @@ -64,6 +64,18 @@ void ModelSelection::add(const ModelIndex& index) notify_selection_changed(); } +void ModelSelection::add_all(const Vector& 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()); diff --git a/Libraries/LibGUI/ModelSelection.h b/Libraries/LibGUI/ModelSelection.h index d40cea4a36..78e0585250 100644 --- a/Libraries/LibGUI/ModelSelection.h +++ b/Libraries/LibGUI/ModelSelection.h @@ -59,6 +59,7 @@ public: void set(const ModelIndex&); void add(const ModelIndex&); + void add_all(const Vector&); void toggle(const ModelIndex&); bool remove(const ModelIndex&); void clear();