summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-12-21 22:47:50 +0100
committerGitHub <noreply@github.com>2017-12-21 22:47:50 +0100
commit3068ccc8e69aad68c860ce8688bdc6d41107be1b (patch)
tree1bb6f45df5f2110b495a75f0e9e40644a31a236f /scene/gui
parentd510c33cd84a8cfc190cb1dce4e19f033704650e (diff)
parent22d87f20faffbbf5b452bc0a35cfd80aebd0f628 (diff)
Merge pull request #14913 from poke1024/tooltip-shortcut-names
Consistent display of shortcut names in tooltips
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp8
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;
}