Browse Source

expose edit_selected in Tree

(cherry picked from commit 13fb24cb6f9ebabb7097aad05550a406022b4c92)
Jummit 4 years ago
parent
commit
0a9190134d
2 changed files with 8 additions and 0 deletions
  1. 7 0
      doc/classes/Tree.xml
  2. 1 0
      scene/gui/tree.cpp

+ 7 - 0
doc/classes/Tree.xml

@@ -48,6 +48,13 @@
 				The new item will be the [code]idx[/code]th child of parent, or it will be the last child if there are not enough siblings.
 				The new item will be the [code]idx[/code]th child of parent, or it will be the last child if there are not enough siblings.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="edit_selected">
+			<return type="bool">
+			</return>
+			<description>
+				Edits the selected tree item as if it was clicked. The item must be set editable with [method TreeItem.set_editable]. Returns [code]true[/code] if the item could be edited. Fails if no item is selected.
+			</description>
+		</method>
 		<method name="ensure_cursor_is_visible">
 		<method name="ensure_cursor_is_visible">
 			<return type="void">
 			<return type="void">
 			</return>
 			</return>

+ 1 - 0
scene/gui/tree.cpp

@@ -4013,6 +4013,7 @@ void Tree::_bind_methods() {
 
 
 	ClassDB::bind_method(D_METHOD("get_edited"), &Tree::get_edited);
 	ClassDB::bind_method(D_METHOD("get_edited"), &Tree::get_edited);
 	ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column);
 	ClassDB::bind_method(D_METHOD("get_edited_column"), &Tree::get_edited_column);
+	ClassDB::bind_method(D_METHOD("edit_selected"), &Tree::edit_selected);
 	ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect);
 	ClassDB::bind_method(D_METHOD("get_custom_popup_rect"), &Tree::get_custom_popup_rect);
 	ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1));
 	ClassDB::bind_method(D_METHOD("get_item_area_rect", "item", "column"), &Tree::_get_item_rect, DEFVAL(-1));
 	ClassDB::bind_method(D_METHOD("get_item_at_position", "position"), &Tree::get_item_at_position);
 	ClassDB::bind_method(D_METHOD("get_item_at_position", "position"), &Tree::get_item_at_position);