Expose selectable property of ItemList's Item
This commit is contained in:
parent
c09c4e0154
commit
cf5cad7126
2 changed files with 11 additions and 1 deletions
|
|
@ -1492,6 +1492,9 @@ bool ItemList::_set(const StringName &p_name, const Variant &p_value) {
|
|||
} else if (components[1] == "disabled") {
|
||||
set_item_disabled(item_index, p_value);
|
||||
return true;
|
||||
} else if (components[1] == "selectable") {
|
||||
set_item_selectable(item_index, p_value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
|
@ -1528,6 +1531,9 @@ bool ItemList::_get(const StringName &p_name, Variant &r_ret) const {
|
|||
} else if (components[1] == "disabled") {
|
||||
r_ret = is_item_disabled(item_index);
|
||||
return true;
|
||||
} else if (components[1] == "selectable") {
|
||||
r_ret = is_item_selectable(item_index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
@ -1541,6 +1547,10 @@ void ItemList::_get_property_list(List<PropertyInfo> *p_list) const {
|
|||
pi.usage &= ~(get_item_icon(i).is_null() ? PROPERTY_USAGE_STORAGE : 0);
|
||||
p_list->push_back(pi);
|
||||
|
||||
pi = PropertyInfo(Variant::BOOL, vformat("item_%d/selectable", i));
|
||||
pi.usage &= ~(is_item_selectable(i) ? PROPERTY_USAGE_STORAGE : 0);
|
||||
p_list->push_back(pi);
|
||||
|
||||
pi = PropertyInfo(Variant::BOOL, vformat("item_%d/disabled", i));
|
||||
pi.usage &= ~(!is_item_disabled(i) ? PROPERTY_USAGE_STORAGE : 0);
|
||||
p_list->push_back(pi);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue