Merge pull request #25422 from azagaya/optionbutton

Fix docs about item_selected and item_focused . Fixes #25273
This commit is contained in:
Rémi Verschelde 2019-02-13 20:31:53 +01:00 committed by GitHub
commit b340b7e804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -71,9 +71,18 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Return the ID of the item at index "idx".
Return the ID of the item at index [code]idx[/code].
</description>
</method>
<method name="get_item_index" qualifiers="const">
<return type="int">
</return>
<argument index="0" name="id" type="int">
</argument>
<description>
Return the index of the item with the given [code]id[/code].
</description>
</method>
<method name="get_item_metadata" qualifiers="const">
<return type="Variant">
</return>
@ -198,14 +207,14 @@
<argument index="0" name="ID" type="int">
</argument>
<description>
This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument (if no IDs were added, ID will be just the item index).
This signal is emitted when user navigated to an item using [code]ui_up[/code] or [code]ui_down[/code] action. ID of the item selected is passed as argument.
</description>
</signal>
<signal name="item_selected">
<argument index="0" name="ID" type="int">
</argument>
<description>
This signal is emitted when the current item was changed by the user. ID of the item selected is passed as argument (if no IDs were added, ID will be just the item index).
This signal is emitted when the current item was changed by the user. Index of the item selected is passed as argument.
</description>
</signal>
</signals>

View File

@ -160,6 +160,12 @@ int OptionButton::get_item_id(int p_idx) const {
return popup->get_item_id(p_idx);
}
int OptionButton::get_item_index(int p_id) const {
return popup->get_item_index(p_id);
}
Variant OptionButton::get_item_metadata(int p_idx) const {
return popup->get_item_metadata(p_idx);
@ -306,6 +312,7 @@ void OptionButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item_text", "idx"), &OptionButton::get_item_text);
ClassDB::bind_method(D_METHOD("get_item_icon", "idx"), &OptionButton::get_item_icon);
ClassDB::bind_method(D_METHOD("get_item_id", "idx"), &OptionButton::get_item_id);
ClassDB::bind_method(D_METHOD("get_item_index", "id"), &OptionButton::get_item_index);
ClassDB::bind_method(D_METHOD("get_item_metadata", "idx"), &OptionButton::get_item_metadata);
ClassDB::bind_method(D_METHOD("is_item_disabled", "idx"), &OptionButton::is_item_disabled);
ClassDB::bind_method(D_METHOD("get_item_count"), &OptionButton::get_item_count);

View File

@ -71,6 +71,7 @@ public:
String get_item_text(int p_idx) const;
Ref<Texture> get_item_icon(int p_idx) const;
int get_item_id(int p_idx) const;
int get_item_index(int p_id) const;
Variant get_item_metadata(int p_idx) const;
bool is_item_disabled(int p_idx) const;