Commit b1c9bdf6 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Merge branch 'jasperh/409818-specific-color-selector' into master

parents 2b099bef 6b2f1c43
...@@ -292,6 +292,24 @@ QWidget* KisFloatColorInput::createInput() ...@@ -292,6 +292,24 @@ QWidget* KisFloatColorInput::createInput()
m_dblNumInput->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); m_dblNumInput->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
m_dblNumInput->setMinimumWidth(60); m_dblNumInput->setMinimumWidth(60);
m_dblNumInput->setMaximumWidth(60); m_dblNumInput->setMaximumWidth(60);
quint8* data = m_color->data() + m_channelInfo->pos();
qreal value = 1.0;
switch (m_channelInfo->channelValueType()) {
#ifdef HAVE_OPENEXR
case KoChannelInfo::FLOAT16:
value = *(reinterpret_cast<half*>(data));
break;
#endif
case KoChannelInfo::FLOAT32:
value = *(reinterpret_cast<float*>(data));
break;
default:
Q_ASSERT(false);
}
m_dblNumInput->setValue(value);
return m_dblNumInput; return m_dblNumInput;
} }
...@@ -312,6 +330,7 @@ void KisFloatColorInput::update() ...@@ -312,6 +330,7 @@ void KisFloatColorInput::update()
qreal value = 1.0; qreal value = 1.0;
m_minValue = m_displayRenderer->minVisibleFloatValue(m_channelInfo); m_minValue = m_displayRenderer->minVisibleFloatValue(m_channelInfo);
m_maxValue = m_displayRenderer->maxVisibleFloatValue(m_channelInfo); m_maxValue = m_displayRenderer->maxVisibleFloatValue(m_channelInfo);
m_colorSlider->blockSignals(true);
switch (m_channelInfo->channelValueType()) { switch (m_channelInfo->channelValueType()) {
#ifdef HAVE_OPENEXR #ifdef HAVE_OPENEXR
...@@ -347,8 +366,8 @@ void KisFloatColorInput::update() ...@@ -347,8 +366,8 @@ void KisFloatColorInput::update()
m_colorSlider->setColors(min, max); m_colorSlider->setColors(min, max);
const qreal floatRange = m_maxValue - m_minValue; const qreal floatRange = m_maxValue - m_minValue;
m_dblNumInput->setValue(value);
m_colorSlider->setValue((value - m_minValue) / floatRange * 255); m_colorSlider->setValue((value - m_minValue) / floatRange * 255);
m_colorSlider->blockSignals(false);
} }
KisHexColorInput::KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage) : KisHexColorInput::KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer, bool usePercentage) :
......
...@@ -128,12 +128,6 @@ QString KisDoubleParseSpinBox::textFromValue(double val) const ...@@ -128,12 +128,6 @@ QString KisDoubleParseSpinBox::textFromValue(double val) const
} }
emit noMoreParsingError(); emit noMoreParsingError();
double v = KisNumericParser::parseSimpleMathExpr(veryCleanText());
v = QString("%1").arg(v, 0, 'f', decimals()).toDouble();
if (hasFocus() && (v == value() || (v > maximum() && value() == maximum()) || (v < minimum() && value() == minimum())) ) { //solve a very annoying bug where the formula can collapse while editing. With this trick the formula is not lost until focus is lost.
return veryCleanText();
}
return QDoubleSpinBox::textFromValue(val); return QDoubleSpinBox::textFromValue(val);
} }
......
...@@ -140,11 +140,6 @@ QString KisIntParseSpinBox::textFromValue(int val) const ...@@ -140,11 +140,6 @@ QString KisIntParseSpinBox::textFromValue(int val) const
emit noMoreParsingError(); emit noMoreParsingError();
int v = KisNumericParser::parseIntegerMathExpr(cleanText());
if (hasFocus() && (v == value() || (v >= maximum() && value() == maximum()) || (v <= minimum() && value() == minimum())) ) { //solve a very annoying bug where the formula can collapse while editing. With this trick the formula is not lost until focus is lost.
return cleanText();
}
return QSpinBox::textFromValue(val); return QSpinBox::textFromValue(val);
} }
......
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