Commit 8bc2965d authored by Jasper Hartog's avatar Jasper Hartog

Fix comparison of double spin box

When the value of a QDoubleSpinBox is changed it will be round down to the amount of decimals that are assigned to that spin box. The KisDoubleParseSpinBox would check the new unrounded value with the current rounded value, which resulted in an incorrect comparison.
parent 818c841b
......@@ -330,6 +330,7 @@ void KisFloatColorInput::update()
qreal value = 1.0;
m_minValue = m_displayRenderer->minVisibleFloatValue(m_channelInfo);
m_maxValue = m_displayRenderer->maxVisibleFloatValue(m_channelInfo);
switch (m_channelInfo->channelValueType()) {
......@@ -362,11 +363,13 @@ void KisFloatColorInput::update()
m_colorSlider->setColors(min, max);
const qreal floatRange = m_maxValue - m_minValue;
m_colorSlider->setValue((value - m_minValue) / floatRange * 255);
......@@ -158,7 +158,8 @@ void KisDoubleParseSpinBox::stepBy(int steps)
void KisDoubleParseSpinBox::setValue(double value)
if(value == oldValue && hasFocus()){ //avoid to reset the button when it set the value of something that will recall this slot.
// Avoid to reset the button when it set the val of something that will recall this slot.
if(hasFocus() && QString::number( value, 'f', this->decimals()) == QString::number( oldValue, 'f', this->decimals())){
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