Skip to content

Commit

Permalink
Merge pull request #71405 from marzecdawid/deselect-root-in-deselect_all
Browse files Browse the repository at this point in the history
Fix `Tree::deselect_all` not deselecting root
  • Loading branch information
YuriSizov authored Mar 27, 2023
2 parents b57f3c2 + 45930e9 commit c0301b7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions scene/gui/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4219,14 +4219,20 @@ Tree::SelectMode Tree::get_select_mode() const {
}

void Tree::deselect_all() {
TreeItem *item = get_next_selected(get_root());
while (item) {
for (int i = 0; i < columns.size(); i++) {
item->deselect(i);
if (root) {
TreeItem *item = root;
while (item) {
if (select_mode == SELECT_ROW) {
item->deselect(0);
} else {
for (int i = 0; i < columns.size(); i++) {
item->deselect(i);
}
}
TreeItem *prev_item = item;
item = get_next_selected(root);
ERR_FAIL_COND(item == prev_item);
}
TreeItem *prev_item = item;
item = get_next_selected(get_root());
ERR_FAIL_COND(item == prev_item);
}

selected_item = nullptr;
Expand Down

0 comments on commit c0301b7

Please sign in to comment.