Merge pull request #22381 from DualMatrix/range_exp_warning
Added warning when min_value of range <= 0 while exp_edit is true.
This commit is contained in:
commit
28c6837219
2 changed files with 19 additions and 0 deletions
|
@ -30,6 +30,19 @@
|
||||||
|
|
||||||
#include "range.h"
|
#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() {
|
void Range::_value_changed_notify() {
|
||||||
|
|
||||||
_value_changed(shared->val);
|
_value_changed(shared->val);
|
||||||
|
@ -91,6 +104,8 @@ void Range::set_min(double p_min) {
|
||||||
set_value(shared->val);
|
set_value(shared->val);
|
||||||
|
|
||||||
shared->emit_changed("min");
|
shared->emit_changed("min");
|
||||||
|
|
||||||
|
update_configuration_warning();
|
||||||
}
|
}
|
||||||
void Range::set_max(double p_max) {
|
void Range::set_max(double p_max) {
|
||||||
|
|
||||||
|
@ -278,6 +293,8 @@ bool Range::is_using_rounded_values() const {
|
||||||
void Range::set_exp_ratio(bool p_enable) {
|
void Range::set_exp_ratio(bool p_enable) {
|
||||||
|
|
||||||
shared->exp_ratio = p_enable;
|
shared->exp_ratio = p_enable;
|
||||||
|
|
||||||
|
update_configuration_warning();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Range::is_ratio_exp() const {
|
bool Range::is_ratio_exp() const {
|
||||||
|
|
|
@ -97,6 +97,8 @@ public:
|
||||||
void share(Range *p_range);
|
void share(Range *p_range);
|
||||||
void unshare();
|
void unshare();
|
||||||
|
|
||||||
|
virtual String get_configuration_warning() const;
|
||||||
|
|
||||||
Range();
|
Range();
|
||||||
~Range();
|
~Range();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue