summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/gui/item_list.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 7d112d1492..2f4f79904d 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -1211,8 +1211,11 @@ String ItemList::get_tooltip(const Point2& p_pos) const {
}
void ItemList::sort_items_by_text() {
+
items.sort();
update();
+ shape_changed=true;
+
if (select_mode==SELECT_SINGLE) {
for(int i=0;i<items.size();i++) {
if (items[i].selected) {
@@ -1304,7 +1307,7 @@ void ItemList::_bind_methods(){
ObjectTypeDB::bind_method(_MD("remove_item","idx"),&ItemList::remove_item);
ObjectTypeDB::bind_method(_MD("clear"),&ItemList::clear);
- ObjectTypeDB::bind_method(_MD("sort_items_by_text"),&ItemList::clear);
+ ObjectTypeDB::bind_method(_MD("sort_items_by_text"),&ItemList::sort_items_by_text);
ObjectTypeDB::bind_method(_MD("set_fixed_column_width","width"),&ItemList::set_fixed_column_width);
ObjectTypeDB::bind_method(_MD("get_fixed_column_width"),&ItemList::get_fixed_column_width);