summaryrefslogtreecommitdiff
path: root/scene/gui/tree.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-02-08 22:22:52 +0100
committerGitHub <noreply@github.com>2021-02-08 22:22:52 +0100
commit59924a09e85e7dabebde1bba003f7cbc2bbb27b1 (patch)
tree19218ca9f3f30e91ae45f7a9f8491de26f5ed48d /scene/gui/tree.cpp
parent74be478895e79bca1552b293e2701cf53404ba7a (diff)
parentef8ec59f2f681440f3aaa6ec69bbaaa1e01164b5 (diff)
Merge pull request #45806 from KoBeWi/forest_of_deselection
Set selected Tree item to null when deselected
Diffstat (limited to 'scene/gui/tree.cpp')
-rw-r--r--scene/gui/tree.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 0049b54f50..744e4e8832 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3322,6 +3322,14 @@ void Tree::item_selected(int p_column, TreeItem *p_item) {
}
void Tree::item_deselected(int p_column, TreeItem *p_item) {
+ if (selected_item == p_item) {
+ selected_item = nullptr;
+ }
+
+ if (selected_col == p_column) {
+ selected_col = -1;
+ }
+
if (select_mode == SELECT_MULTI || select_mode == SELECT_SINGLE) {
p_item->cells.write[p_column].selected = false;
}