diff options
author | volzhs <volzhs@gmail.com> | 2016-11-05 02:34:19 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2016-11-05 02:34:19 +0900 |
commit | 80b6507071ffd65f4ed397b7994482229fb303e0 (patch) | |
tree | 9863d1d59daa0fd8bc971c0135ae96c4a84bded9 | |
parent | 90519b295c234fd8c13647892ff711852445e2a1 (diff) |
Fix updating value of SpinBox with prefix
-rw-r--r-- | scene/gui/spin_box.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 98e1a32aef..9417c25424 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -51,7 +51,10 @@ void SpinBox::_text_entered(const String& p_string) { //if (!p_string.is_numeric()) // return; - set_val( p_string.to_double() ); + String value = p_string; + if (prefix!="" && p_string.begins_with(prefix)) + value = p_string.substr(prefix.length(), p_string.length()-prefix.length()); + set_val( value.to_double() ); _value_changed(0); } |