Fix logic error when trying to find hovered item

Was just comparing this item's and the parent item's names. But if an item has
no parents, only its own name has to match for the check to return true. Make
sure that the number of parents also matches.
This commit is contained in:
Julian Eisel 2021-10-06 16:52:16 +02:00
parent bbfa6a92cf
commit 8a6f224e26
1 changed files with 3 additions and 0 deletions

View File

@ -439,6 +439,9 @@ bool AbstractTreeViewItem::matches_including_parents(const AbstractTreeViewItem
if (!matches(other)) {
return false;
}
if (count_parents() != other.count_parents()) {
return false;
}
for (AbstractTreeViewItem *parent = parent_, *other_parent = other.parent_;
parent && other_parent;