mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Fix MenuBar min size not updating after child rename
This commit is contained in:
parent
45fc515ae3
commit
b2d47352d0
1 changed files with 7 additions and 1 deletions
|
|
@ -519,13 +519,14 @@ void MenuBar::_refresh_menu_names() {
|
|||
bool is_global = !global_menu_tag.is_empty();
|
||||
RID main_menu = is_global ? nmenu->get_system_menu(NativeMenu::MAIN_MENU_ID) : RID();
|
||||
|
||||
bool dirty = false;
|
||||
Vector<PopupMenu *> popups = _get_popups();
|
||||
for (int i = 0; i < popups.size(); i++) {
|
||||
String menu_name = popups[i]->get_title().is_empty() ? String(popups[i]->get_name()) : popups[i]->get_title();
|
||||
if (!popups[i]->has_meta("_menu_name") && menu_name != get_menu_title(i)) {
|
||||
menu_cache.write[i].name = menu_name;
|
||||
shape(menu_cache.write[i]);
|
||||
queue_redraw();
|
||||
dirty = true;
|
||||
if (is_global && menu_cache[i].submenu_rid.is_valid()) {
|
||||
int item_idx = nmenu->find_item_index_with_submenu(main_menu, menu_cache[i].submenu_rid);
|
||||
if (item_idx >= 0) {
|
||||
|
|
@ -534,6 +535,11 @@ void MenuBar::_refresh_menu_names() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty && !is_global) {
|
||||
queue_redraw();
|
||||
update_minimum_size();
|
||||
}
|
||||
}
|
||||
|
||||
Vector<PopupMenu *> MenuBar::_get_popups() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue