mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 05:47:34 +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:
parent
b532b2d3ca
commit
169beff21e
2 changed files with 13 additions and 0 deletions
|
@ -64,6 +64,18 @@ void ModelSelection::add(const ModelIndex& index)
|
||||||
notify_selection_changed();
|
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)
|
void ModelSelection::toggle(const ModelIndex& index)
|
||||||
{
|
{
|
||||||
ASSERT(index.is_valid());
|
ASSERT(index.is_valid());
|
||||||
|
|
|
@ -59,6 +59,7 @@ public:
|
||||||
|
|
||||||
void set(const ModelIndex&);
|
void set(const ModelIndex&);
|
||||||
void add(const ModelIndex&);
|
void add(const ModelIndex&);
|
||||||
|
void add_all(const Vector<ModelIndex>&);
|
||||||
void toggle(const ModelIndex&);
|
void toggle(const ModelIndex&);
|
||||||
bool remove(const ModelIndex&);
|
bool remove(const ModelIndex&);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue