Commit 365ac1aa authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[FIX #217] - this fixes the issue of min/max sliders preventing proper setting...

[FIX #217] - this fixes the issue of min/max sliders preventing proper setting of new min/max values. This was previously semi-fixed for WPropDouble. This fix works for int and double widgets in a better way. It sets the new min/max to the min/max slider only if it was min/max prevously -> keeps previously set intervals
parent fba9804e
......@@ -116,17 +116,9 @@ void WPropertyDoubleWidget::update()
m_slider.setMinimum( 0 );
m_slider.setMaximum( SliderResolution );
bool allowedValuesUpdated = m_intervalEdit.getAllowedMin() != minC->getMin()
|| m_intervalEdit.getAllowedMax() != maxC->getMax();
// update the interval edit too
m_intervalEdit.setAllowedMin( minC->getMin() );
m_intervalEdit.setAllowedMax( maxC->getMax() );
if( allowedValuesUpdated )
{
m_intervalEdit.setMin( minC->getMin() );
m_intervalEdit.setMax( maxC->getMax() );
}
m_min = m_intervalEdit.getMin();
m_max = m_intervalEdit.getMax();
......
......@@ -292,8 +292,10 @@ void WQtIntervalEdit< DataType, DisplayType >::setAllowedMin( DataType min )
return;
}
// if the new allowed min is larger than the currently set min -> change m_min too
if( min > m_min )
// check two cases:
// 1: if the new allowed min is larger than the currently set min -> change m_min too
// 2: the new min is smaller then the allowed one and the slider is still at 0 -> keep slider there
if( ( min > m_min ) || ( ( min < m_min ) && ( m_minSlider.value() == 0 ) ) )
{
m_min = min;
emit minimumChanged();
......@@ -309,8 +311,11 @@ void WQtIntervalEdit< DataType, DisplayType >::setAllowedMax( DataType max )
{
return;
}
// if the new allowed max is smaller than the currently set max -> change m_max too
if( max < m_max )
// check two cases:
// 1: if the new allowed max is smaller than the currently set max -> change m_max too
// 2: the new max is larger then the allowed one and the slider is still at the max -> keep slider at 100
if( ( max < m_max ) || ( ( max > m_max ) && ( m_maxSlider.value() == SliderResolution ) ) )
{
m_max = max;
emit maximumChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment