You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-27 15:57:02 +00:00
Add radio-button-looking entries to PopupMenu
They work exactly the same as current checkbox-decorated items, but in order to preserve compatibility, separate methods are used, like `add_radio_check_item()`. The other option would have been to add a new parameter at the end of `add_check_item()` and the like, but that would have forced callers to provide the defaults manually.
`is_item_checkable()`, `is_item_checked()` and `set_item_checked()` are used regardless the item is set to look as check box or radio button.
Keeping check in the name adds an additional clue about these facts.
Closes #13055.
(cherry picked from commit ab3b1d9f3e)
This commit is contained in:
committed by
Hein-Pieter van Braam
parent
3b57b95efb
commit
a525ea128d
@@ -692,6 +692,10 @@ ThemeEditor::ThemeEditor() {
|
||||
test_menu_button->get_popup()->add_check_item(TTR("Check Item"));
|
||||
test_menu_button->get_popup()->add_check_item(TTR("Checked Item"));
|
||||
test_menu_button->get_popup()->set_item_checked(2, true);
|
||||
test_menu_button->get_popup()->add_separator();
|
||||
test_menu_button->get_popup()->add_check_item(TTR("Radio Item"));
|
||||
test_menu_button->get_popup()->add_radio_check_item(TTR("Checked Radio Item"));
|
||||
test_menu_button->get_popup()->set_item_checked(5, true);
|
||||
first_vb->add_child(test_menu_button);
|
||||
|
||||
OptionButton *test_option_button = memnew(OptionButton);
|
||||
|
||||
Reference in New Issue
Block a user