diff options
Diffstat (limited to 'scene/gui/popup_menu.cpp')
-rw-r--r-- | scene/gui/popup_menu.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 6e0f1c5198..61a5fb999c 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -736,26 +736,7 @@ void PopupMenu::_notification(int p_what) { } } break; case NOTIFICATION_THEME_CHANGED: - case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { - // Pass the layout direction to all submenus. - for (int i = 0; i < items.size(); i++) { - if (items[i].submenu.is_empty()) { - continue; - } - - Node *n = get_node(items[i].submenu); - if (!n) { - continue; - } - - PopupMenu *pm = Object::cast_to<PopupMenu>(n); - if (pm) { - pm->set_layout_direction(get_layout_direction()); - } - } - - [[fallthrough]]; - } + case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { for (int i = 0; i < items.size(); i++) { items.write[i].xl_text = atr(items[i].text); @@ -844,7 +825,7 @@ void PopupMenu::_notification(int p_what) { #define ITEM_SETUP_WITH_ACCEL(p_label, p_id, p_accel) \ item.text = p_label; \ item.xl_text = atr(p_label); \ - item.id = p_id == -1 ? items.size() - 1 : p_id; \ + item.id = p_id == -1 ? items.size() : p_id; \ item.accel = p_accel; void PopupMenu::add_item(const String &p_label, int p_id, Key p_accel) { @@ -926,7 +907,7 @@ void PopupMenu::add_multistate_item(const String &p_label, int p_max_states, int _ref_shortcut(p_shortcut); \ item.text = p_shortcut->get_name(); \ item.xl_text = atr(item.text); \ - item.id = p_id == -1 ? items.size() - 1 : p_id; \ + item.id = p_id == -1 ? items.size() : p_id; \ item.shortcut = p_shortcut; \ item.shortcut_is_global = p_global; @@ -995,7 +976,7 @@ void PopupMenu::add_submenu_item(const String &p_label, const String &p_submenu, Item item; item.text = p_label; item.xl_text = atr(p_label); - item.id = p_id == -1 ? items.size() - 1 : p_id; + item.id = p_id == -1 ? items.size() : p_id; item.submenu = p_submenu; items.push_back(item); _shape_item(items.size() - 1); |