You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
Merge pull request #59315 from KoBeWi/less_options_in_OptionButton_or_something
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
<description>
|
<description>
|
||||||
OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text.
|
OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text.
|
||||||
See also [BaseButton] which contains common properties and methods associated with this node.
|
See also [BaseButton] which contains common properties and methods associated with this node.
|
||||||
|
[b]Note:[/b] Properties [member Button.text] and [member Button.icon] are automatically set based on the selected item. They shouldn't be changed manually.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|||||||
@@ -385,6 +385,12 @@ void OptionButton::get_translatable_strings(List<String> *p_strings) const {
|
|||||||
popup->get_translatable_strings(p_strings);
|
popup->get_translatable_strings(p_strings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionButton::_validate_property(PropertyInfo &property) const {
|
||||||
|
if (property.name == "text" || property.name == "icon") {
|
||||||
|
property.usage = PROPERTY_USAGE_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OptionButton::_bind_methods() {
|
void OptionButton::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1));
|
ClassDB::bind_method(D_METHOD("add_item", "label", "id"), &OptionButton::add_item, DEFVAL(-1));
|
||||||
ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item, DEFVAL(-1));
|
ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id"), &OptionButton::add_icon_item, DEFVAL(-1));
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ protected:
|
|||||||
bool _set(const StringName &p_name, const Variant &p_value);
|
bool _set(const StringName &p_name, const Variant &p_value);
|
||||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||||
|
virtual void _validate_property(PropertyInfo &property) const override;
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user