diff options
author | poke1024 <poke1024@gmx.de> | 2017-12-21 20:17:30 +0100 |
---|---|---|
committer | poke1024 <poke1024@gmx.de> | 2017-12-21 20:17:30 +0100 |
commit | 22d87f20faffbbf5b452bc0a35cfd80aebd0f628 (patch) | |
tree | a904a13914cb89aaf9e4184ffc636ad6c145c311 /scene/gui | |
parent | b872439eefb7d54a572ace3a57fea01787c46952 (diff) |
Consistent display of shortcut names in tooltips
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/base_button.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 148277f2dd..a67fe2aeeb 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -450,11 +450,11 @@ String BaseButton::get_tooltip(const Point2 &p_pos) const { String tooltip = Control::get_tooltip(p_pos); if (shortcut.is_valid() && shortcut->is_valid()) { - if (tooltip.find("$sc") != -1) { - tooltip = tooltip.replace_first("$sc", "(" + shortcut->get_as_text() + ")"); - } else { - tooltip += " (" + shortcut->get_as_text() + ")"; + String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")"; + if (shortcut->get_name().nocasecmp_to(tooltip) != 0) { + text += "\n" + tooltip; } + tooltip = text; } return tooltip; } |