Merge pull request #25901 from godotengine/revert-25841-menubutton-fix

Revert "Fix MenuButton item label disappearing when setting shortcut."
This commit is contained in:
Rémi Verschelde 2019-02-15 12:16:14 +01:00 committed by GitHub
commit 962c14278f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -79,8 +79,7 @@ Size2 PopupMenu::get_minimum_size() const {
size.width += check_w + hseparation; size.width += check_w + hseparation;
} }
String text = items[i].xl_text; String text = items[i].shortcut.is_valid() ? String(tr(items[i].shortcut->get_name())) : items[i].xl_text;
size.width += font->get_string_size(text).width; size.width += font->get_string_size(text).width;
if (i > 0) if (i > 0)
size.height += vseparation; size.height += vseparation;
@ -468,7 +467,7 @@ void PopupMenu::_notification(int p_what) {
hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation))); hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation)));
} }
String text = items[i].xl_text; String text = items[i].shortcut.is_valid() ? String(tr(items[i].shortcut->get_name())) : items[i].xl_text;
item_ofs.x += items[i].h_ofs; item_ofs.x += items[i].h_ofs;
if (items[i].separator) { if (items[i].separator) {