diff options
author | DualMatrix <piet.goris@gmail.com> | 2018-09-23 20:59:35 +0200 |
---|---|---|
committer | DualMatrix <piet.goris@gmail.com> | 2018-09-23 20:59:35 +0200 |
commit | e78bfe19a7bb4cad7609eb6e343585d06c0731b4 (patch) | |
tree | c543d9f6630a18cbbb0da116cb13c5569a6306e1 | |
parent | 2c7908739a9508cdd725fdd3175477f4d048ea26 (diff) |
Added warning when min_value of range is smaller than 0 while exp_edit is true.
Added warning when min_value of range is smaller than 0 while exp_edit is true.
The new warning is: "If exp_edit is true min_value must be > 0."
-rw-r--r-- | scene/gui/range.cpp | 17 | ||||
-rw-r--r-- | scene/gui/range.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index 09d8664240..125cf7dc75 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -30,6 +30,19 @@ #include "range.h" +String Range::get_configuration_warning() const { + String warning = Control::get_configuration_warning(); + + if (shared->exp_ratio && shared->min <= 0) { + if (warning != String()) { + warning += "\n"; + } + warning += TTR("If exp_edit is true min_value must be > 0."); + } + + return warning; +} + void Range::_value_changed_notify() { _value_changed(shared->val); @@ -90,6 +103,8 @@ void Range::set_min(double p_min) { set_value(shared->val); shared->emit_changed("min"); + + update_configuration_warning(); } void Range::set_max(double p_max) { @@ -277,6 +292,8 @@ bool Range::is_using_rounded_values() const { void Range::set_exp_ratio(bool p_enable) { shared->exp_ratio = p_enable; + + update_configuration_warning(); } bool Range::is_ratio_exp() const { diff --git a/scene/gui/range.h b/scene/gui/range.h index 125f559248..58f15c8aa8 100644 --- a/scene/gui/range.h +++ b/scene/gui/range.h @@ -97,6 +97,8 @@ public: void share(Range *p_range); void unshare(); + virtual String get_configuration_warning() const; + Range(); ~Range(); }; |