Move TreeSearch::update_tree in TaskTree from update_tree

Catches all cases where the tree is modified. Also those, where for example the tab is switched.
This commit is contained in:
Alexander Montag 2024-09-27 15:24:14 +00:00
parent 47706e9480
commit 9a1641e8ab
1 changed files with 6 additions and 1 deletions

View File

@ -47,6 +47,12 @@ TreeItem *TaskTree::_create_tree(const Ref<BTTask> &p_task, TreeItem *p_parent,
_create_tree(p_task->get_child(i), item); _create_tree(p_task->get_child(i), item);
} }
_update_item(item); _update_item(item);
// update TreeSearch if root task was created
if (tree->get_root() == item){
tree_search->update_search(tree);
}
return item; return item;
} }
@ -126,7 +132,6 @@ void TaskTree::_update_tree() {
for (const Ref<BTTask> &task : selection) { for (const Ref<BTTask> &task : selection) {
add_selection(task); add_selection(task);
} }
tree_search->update_search(tree);
} }
TreeItem *TaskTree::_find_item(const Ref<BTTask> &p_task) const { TreeItem *TaskTree::_find_item(const Ref<BTTask> &p_task) const {