From e1054a17b5abcb39adf02aba758fab533c3f6b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 8 Feb 2021 02:16:23 +0100 Subject: [PATCH] Expose Tree::scroll_to_item() --- scene/gui/tree.cpp | 1 + scene/gui/tree.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 8c431905d29..386f8da17c3 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -4017,6 +4017,7 @@ void Tree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_column_title", "column", "title"), &Tree::set_column_title); ClassDB::bind_method(D_METHOD("get_column_title", "column"), &Tree::get_column_title); ClassDB::bind_method(D_METHOD("get_scroll"), &Tree::get_scroll); + ClassDB::bind_method(D_METHOD("scroll_to_item", "item"), &Tree::_scroll_to_item); ClassDB::bind_method(D_METHOD("set_hide_folding", "hide"), &Tree::set_hide_folding); ClassDB::bind_method(D_METHOD("is_folding_hidden"), &Tree::is_folding_hidden); diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 45c5f3d7bf9..6215e4a1254 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -529,6 +529,10 @@ protected: return get_item_rect(Object::cast_to(p_item), p_column); } + void _scroll_to_item(Object *p_item) { + scroll_to_item(Object::cast_to(p_item)); + } + public: virtual String get_tooltip(const Point2 &p_pos) const;