SliderPlusBox: Can change slider max value
This commit is contained in:
@@ -14,6 +14,10 @@ SliderPlusBox::SliderPlusBox(double min, double max, double step, int decimals,
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Minimum value must be greater than zero for logarithmic scale");
|
||||
|
||||
if (m_max <= m_min)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Maximum value must be greater than minimum");
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
@@ -117,6 +121,14 @@ void SliderPlusBox::setValue(double value) {
|
||||
m_doubleSpinBox->setValue(value);
|
||||
}
|
||||
|
||||
void SliderPlusBox::setMax(double value) {
|
||||
if (value <= m_min)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Maximum value must be greater than minimum");
|
||||
m_max = value;
|
||||
updateSliderRange();
|
||||
}
|
||||
|
||||
void SliderPlusBox::setScaleType(ScaleType type) {
|
||||
if (m_scaleType == type)
|
||||
return;
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
double value() const { return v; }
|
||||
void setScaleType(ScaleType type);
|
||||
ScaleType scaleType() const { return m_scaleType; }
|
||||
void setMax(double max);
|
||||
|
||||
signals:
|
||||
void valueChanged(double value);
|
||||
|
||||
Reference in New Issue
Block a user