summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-11 17:01:15 -0300
committerGitHub <noreply@github.com>2016-06-11 17:01:15 -0300
commitb5f2ea542a563fc44870417f1343fd9cb9acc253 (patch)
treedc4b667dd88f0478cbb5e675e97375bbba2f53bb /scene/gui
parentfc7adf0b4c2d501ca2732d366156ad32e187a912 (diff)
parent90b3f702bdc3ad6228f302cc8c9f7d5f272460dc (diff)
Merge pull request #5161 from neikeq/pr-imp-sc-tooltip
BaseButton: Add identifier for shortcut in tooltip
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/base_button.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 2200cac5da..bc498f47bc 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -418,8 +418,13 @@ void BaseButton::_unhandled_input(InputEvent p_event) {
String BaseButton::get_tooltip(const Point2& p_pos) const {
String tooltip=Control::get_tooltip(p_pos);
- if (shortcut.is_valid() && shortcut->is_valid())
- tooltip+=" ("+shortcut->get_as_text()+")";
+ 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()+")";
+ }
+ }
return tooltip;
}