diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-06-16 12:00:49 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-06-16 12:00:49 -0300 |
commit | 98d0c99652fbd3d7178b3a2794fe069cde7b9809 (patch) | |
tree | 3031bb3853c7dab0d25c10787680feed1d5176b1 /scene/gui | |
parent | 9c7cce3c9b8062817e976676ff0f4772971895cb (diff) |
Fix Range's "changed" signal emitting with a value even if binded to emit none
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/range.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index c24e62c8cb..d00acaf08a 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -63,7 +63,7 @@ void Range::Shared::emit_value_changed() { void Range::_changed_notify(const char *p_what) { - emit_signal("changed", shared->val); + emit_signal("changed"); update(); _change_notify(p_what); } @@ -79,6 +79,7 @@ void Range::Shared::emit_changed(const char *p_what) { } void Range::set_value(double p_val) { + if (shared->step > 0) p_val = Math::round(p_val / shared->step) * shared->step; @@ -303,22 +304,27 @@ bool Range::is_ratio_exp() const { } void Range::set_allow_greater(bool p_allow) { + shared->allow_greater = p_allow; } bool Range::is_greater_allowed() const { + return shared->allow_greater; } void Range::set_allow_lesser(bool p_allow) { + shared->allow_lesser = p_allow; } bool Range::is_lesser_allowed() const { + return shared->allow_lesser; } Range::Range() { + shared = memnew(Shared); shared->min = 0; shared->max = 100; |