From 2d14164bca2f2df007f3f56dde6061051b544221 Mon Sep 17 00:00:00 2001 From: Nathan Franke Date: Thu, 26 May 2022 05:12:57 -0500 Subject: [PATCH] tree: always emit item_edited --- scene/gui/tree.cpp | 9 ++++----- scene/gui/tree.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 4d18bc91c4cd..8f292533e66d 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3971,16 +3971,15 @@ TreeItem *Tree::get_last_item() const { return last; } -void Tree::item_edited(int p_column, TreeItem *p_item, MouseButton p_mouse_index) { +void Tree::item_edited(int p_column, TreeItem *p_item, MouseButton p_custom_mouse_index) { edited_item = p_item; edited_col = p_column; if (p_item != nullptr && p_column >= 0 && p_column < p_item->cells.size()) { edited_item->cells.write[p_column].dirty = true; } - if (p_mouse_index == MouseButton::NONE) { - emit_signal(SNAME("item_edited")); - } else { - emit_signal(SNAME("custom_item_clicked"), p_mouse_index); + emit_signal(SNAME("item_edited")); + if (p_custom_mouse_index != MouseButton::NONE) { + emit_signal(SNAME("custom_item_clicked"), p_custom_mouse_index); } } diff --git a/scene/gui/tree.h b/scene/gui/tree.h index a70f24cb623d..0a8dd3204abb 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -474,7 +474,7 @@ class Tree : public Control { void _notification(int p_what); - void item_edited(int p_column, TreeItem *p_item, MouseButton p_mouse_index = MouseButton::NONE); + void item_edited(int p_column, TreeItem *p_item, MouseButton p_custom_mouse_index = MouseButton::NONE); void item_changed(int p_column, TreeItem *p_item); void item_selected(int p_column, TreeItem *p_item); void item_deselected(int p_column, TreeItem *p_item);