mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 08:54:53 +01:00
remove indexes implemented remove_indexes content
This commit is contained in:
parent
44cc3d4011
commit
188cf1e57a
1 changed files with 19 additions and 0 deletions
|
|
@ -435,6 +435,25 @@ class HierarchyModel(QtCore.QAbstractItemModel):
|
|||
|
||||
def remove_indexes(self, indexes):
|
||||
items_by_id = {}
|
||||
processed_ids = set()
|
||||
for index in indexes:
|
||||
if not index.isValid():
|
||||
continue
|
||||
|
||||
item_id = index.data(IDENTIFIER_ROLE)
|
||||
# There may be indexes for multiple columns
|
||||
if item_id not in processed_ids:
|
||||
processed_ids.add(item_id)
|
||||
|
||||
item = self._items_by_id[item_id]
|
||||
if isinstance(item, (TaskItem, AssetItem)):
|
||||
items_by_id[item_id] = item
|
||||
|
||||
if not items_by_id:
|
||||
return
|
||||
|
||||
for item in items_by_id.values():
|
||||
self._remove_item(item)
|
||||
|
||||
def _remove_item(self, item):
|
||||
is_removed = item.data(None, REMOVED_ROLE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue