summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-11-06 12:07:54 +0100
committerGitHub <noreply@github.com>2016-11-06 12:07:54 +0100
commitc099b32b6c35deea09788c72469c42b5fb432992 (patch)
treef8d5013c2b285f2147c1643db8b6e0a34af72292
parent57cc953cffc1fa7d8a1e0b44436b4ed8090dfd50 (diff)
parent80b6507071ffd65f4ed397b7994482229fb303e0 (diff)
Merge pull request #7036 from volzhs/spinbox-prefix
Fix updating value of SpinBox with prefix
-rw-r--r--scene/gui/spin_box.cpp5
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);
}