summaryrefslogtreecommitdiff
path: root/scene/gui/item_list.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-07-22 07:45:52 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-07-22 08:08:17 +0200
commit51b03f0bf5af5cb6041b454a846061b5a7ff2d4c (patch)
treef9dbe5eb881a6329229f8186026cb8870281803c /scene/gui/item_list.cpp
parent93c3c801dbc01251ee7b9e45066936c95eb510e1 (diff)
Fix binding for ItemList.sort_items_by_text
Also forces to recompute the cached rect for all items. Fixes #5799
Diffstat (limited to 'scene/gui/item_list.cpp')
-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);