Fix optimization through which the parent count is not drawn

This commit is contained in:
Alexander Montag 2024-09-29 18:12:18 +02:00
parent 5a66160bce
commit 585d9663d6
No known key found for this signature in database
GPG Key ID: 07FE50B35A2B7524
2 changed files with 5 additions and 3 deletions

View File

@ -93,8 +93,9 @@ void TreeSearch::_clear_filter() {
void TreeSearch::_highlight_tree() {
ERR_FAIL_COND(!tree_reference);
for (int i = 0; i < matching_entries.size(); i++) {
TreeItem *tree_item = matching_entries[i];
// This might not be the prettiest, but it is the most efficient solution probably.
for (HashMap<TreeItem *, int>::Iterator it = number_matches.begin(); it != number_matches.end(); ++it) {
TreeItem *tree_item = it->key;
_highlight_tree_item(tree_item);
}
tree_reference->queue_redraw();

View File

@ -56,6 +56,7 @@ private:
// linearized ordering of tree items.
Vector<TreeItem *> ordered_tree_items;
// entires that match the search mask.
// TODO: Decide if this can be removed. It can be implicitly infered from number_matches.
Vector<TreeItem *> matching_entries;
// number of descendant matches for each tree item.
HashMap<TreeItem *, int> number_matches;