Linux specific issue: Prevent ObjectList's events, when updating the volumes in object.

On Linux DeleteVolumeChildren() called the update selection event, what caused the unexpected one by one selection of all volumes in object.
This commit is contained in:
YuSanka 2022-11-07 13:47:07 +01:00
parent 8abb8a6546
commit 380c746871

View File

@ -2882,6 +2882,9 @@ static bool can_add_volumes_to_object(const ModelObject* object)
wxDataViewItemArray ObjectList::add_volumes_to_object_in_list(size_t obj_idx, std::function<bool(const ModelVolume*)> add_to_selection/* = nullptr*/) wxDataViewItemArray ObjectList::add_volumes_to_object_in_list(size_t obj_idx, std::function<bool(const ModelVolume*)> add_to_selection/* = nullptr*/)
{ {
const bool is_prevent_list_events = m_prevent_list_events;
m_prevent_list_events = true;
wxDataViewItem object_item = m_objects_model->GetItemById(int(obj_idx)); wxDataViewItem object_item = m_objects_model->GetItemById(int(obj_idx));
m_objects_model->DeleteVolumeChildren(object_item); m_objects_model->DeleteVolumeChildren(object_item);
@ -2909,6 +2912,7 @@ wxDataViewItemArray ObjectList::add_volumes_to_object_in_list(size_t obj_idx, st
Expand(object_item); Expand(object_item);
} }
m_prevent_list_events = is_prevent_list_events;
return items; return items;
} }