summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-15 12:16:14 +0100
committerGitHub <noreply@github.com>2019-02-15 12:16:14 +0100
commit962c14278fafecf3d047fd070fc7ab8d4dcc21da (patch)
tree17ebbfa0a9aa0a60036436a061513f929738750d
parent3f74a54cd498a7857557bdca6b034b0b38f662b0 (diff)
parentfe7d2dc4d330e32e015b62ccbc93a85ccdf97bd6 (diff)
Merge pull request #25901 from godotengine/revert-25841-menubutton-fix
Revert "Fix MenuButton item label disappearing when setting shortcut."
-rw-r--r--scene/gui/popup_menu.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 75307d579e..ac94ac63ec 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -79,8 +79,7 @@ Size2 PopupMenu::get_minimum_size() const {
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;
if (i > 0)
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)));
}
- 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;
if (items[i].separator) {