[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita/krita-testing-wolthera] libs/ui/widgets: Fix spinbox updating float.
From: Wolthera van Hovell tot Westerflier <griffinvalley () gmail ! com>
Date: 2016-08-16 18:52:13
Message-ID: E1bZjTB-0005JB-3W () code ! kde ! org
[Download RAW message or body]
Git commit 62a4f7c6aea23277d40acd5700ac28b3dada1174 by Wolthera van Hovell tot \
Westerflier. Committed on 16/08/2016 at 16:57.
Pushed by woltherav into branch 'krita-testing-wolthera'.
Fix spinbox updating float.
Again, could be prettier.
Ref T2337
M +24 -16 libs/ui/widgets/kis_spinbox_color_selector.cpp
http://commits.kde.org/krita/62a4f7c6aea23277d40acd5700ac28b3dada1174
diff --git a/libs/ui/widgets/kis_spinbox_color_selector.cpp \
b/libs/ui/widgets/kis_spinbox_color_selector.cpp index 5367e92..1d8f211 100644
--- a/libs/ui/widgets/kis_spinbox_color_selector.cpp
+++ b/libs/ui/widgets/kis_spinbox_color_selector.cpp
@@ -130,6 +130,7 @@ void KisSpinboxColorSelector::slotSetColorSpace(const \
KoColorSpace *cs) input->setMaximum(KoColorSpaceMathsTraits<float>::max);
input->setSingleStep(0.1);
m_d->doubleSpinBoxList.append(input);
+ qDebug()<<"add "<<channel->name()<<"doubleSpinBoxList \
"<<m_d->doubleSpinBoxList.size(); layout->addRow(inputLabel,input);
if (input) {
connect(input, SIGNAL(valueChanged(double)), this, \
SLOT(slotUpdateFromSpinBoxes())); @@ -159,15 +160,22 @@ void \
KisSpinboxColorSelector::createColorFromSpinboxValues()
for (int i=0; i<abs(m_d->cs->colorChannelCount()); i++) {
int channelposition = KoChannelInfo::displayPositionToChannelIndex(i, \
m_d->cs->channels());
- if (m_d->spinBoxList.at(i)) {
- if (channels.at(i)->channelValueType()==KoChannelInfo::UINT8){
- int value = m_d->spinBoxList.at(i)->value();
- channelValues[channelposition] = \
KoColorSpaceMaths<quint8,float>::scaleToA(value);
- } else if (channels.at(i)->channelValueType()==KoChannelInfo::UINT16){
- channelValues[channelposition] = \
KoColorSpaceMaths<quint16,float>::scaleToA(m_d->spinBoxList.at(i)->value());
- }
- } else if (m_d->doubleSpinBoxList.at(i)){
+
+ if (channels.at(i)->channelValueType()==KoChannelInfo::UINT8 && \
m_d->spinBoxList.at(i)){ +
+ int value = m_d->spinBoxList.at(i)->value();
+ channelValues[channelposition] = \
KoColorSpaceMaths<quint8,float>::scaleToA(value); +
+ } else if (channels.at(i)->channelValueType()==KoChannelInfo::UINT16 && \
m_d->spinBoxList.at(i)){ +
+ channelValues[channelposition] = \
KoColorSpaceMaths<quint16,float>::scaleToA(m_d->spinBoxList.at(i)->value()); +
+ } else if ((channels.at(i)->channelValueType()==KoChannelInfo::FLOAT16 ||
+ channels.at(i)->channelValueType()==KoChannelInfo::FLOAT32 ||
+ channels.at(i)->channelValueType()==KoChannelInfo::FLOAT64) && \
m_d->doubleSpinBoxList.at(i)) { +
channelValues[channelposition] = m_d->doubleSpinBoxList.at(i)->value();
+
}
}
@@ -206,14 +214,14 @@ void KisSpinboxColorSelector::updateSpinboxesWithNewValues()
for (i=0; i<abs(m_d->cs->colorChannelCount()); i++) {
int channelposition = KoChannelInfo::displayPositionToChannelIndex(i, \
m_d->cs->channels());
- if (m_d->spinBoxList.at(i)) {
- if (channels.at(i)->channelValueType() == KoChannelInfo::UINT8) {
- int value = KoColorSpaceMaths<float, \
quint8>::scaleToA(channelValues[channelposition]);
- m_d->spinBoxList.at(i)->setValue(value);
- } else if (channels.at(i)->channelValueType() == KoChannelInfo::UINT16) \
{
- m_d->spinBoxList.at(i)->setValue(KoColorSpaceMaths<float, \
quint16>::scaleToA(channelValues[channelposition]));
- }
- } else if (m_d->doubleSpinBoxList.at(i)) {
+ if (channels.at(i)->channelValueType() == KoChannelInfo::UINT8 && \
m_d->spinBoxList.at(i)) { + int value = KoColorSpaceMaths<float, \
quint8>::scaleToA(channelValues[channelposition]); + \
m_d->spinBoxList.at(i)->setValue(value); + } else if \
(channels.at(i)->channelValueType() == KoChannelInfo::UINT16 && \
m_d->spinBoxList.at(i)) { + \
m_d->spinBoxList.at(i)->setValue(KoColorSpaceMaths<float, \
quint16>::scaleToA(channelValues[channelposition])); + } else if \
((channels.at(i)->channelValueType()==KoChannelInfo::FLOAT16 || + \
channels.at(i)->channelValueType()==KoChannelInfo::FLOAT32 || + \
channels.at(i)->channelValueType()==KoChannelInfo::FLOAT64) && \
m_d->doubleSpinBoxList.at(i)) {
m_d->doubleSpinBoxList.at(i)->setValue(channelValues[channelposition]);
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic