45 m_cachedColorSpace(0),
46 m_displayHelpText(false),
47 m_parentProxy(parentProxy)
49 setParam(hueDelta, satDelta, valDelta, hueShift, satShift, valShift);
121 int patchSpacing = 0;
125 patchCount = width();
132 patchWidth = std::lround((width() - patchSpacing * patchCount) / qreal(patchCount));
135 qreal saturationStep;
150 qreal baseSaturation;
153 getHsvF(
m_realColor, &baseHue, &baseSaturation, &baseValue);
156 for(
int i=-patchCount/2; i<=patchCount/2; i++) {
157 if(i==0 && patchCount%2==0)
continue;
158 qreal hue = baseHue + (i * hueStep) +
m_hueShift;
159 while (hue < 0.0) hue += 1.0;
160 while (hue > 1.0) hue -= 1.0;
162 qreal saturation = qBound<qreal>(0., baseSaturation + (i * saturationStep) +
m_saturationShift, 1.);
167 saturation=baseSaturation;
171 const QRect patchRect(z * (patchWidth + patchSpacing), 0, patchWidth,
m_lineHeight);
180 QPainter wpainter(
this);
182 wpainter.setOpacity(0.2);
185 wpainter.drawImage(0, 0, renderedImage);
187 wpainter.setPen(QColor(175,175,175));
188 wpainter.drawRect(renderedImage.width()/2-5,0,10,renderedImage.height()-1);
189 wpainter.setPen(QColor(75,75,75));
190 wpainter.drawRect(renderedImage.width()/2-4,0,8,renderedImage.height()-1);
191 wpainter.setPen(QColor(175,175,175));
193 wpainter.drawRect(mouseX-5,0,10,renderedImage.height()-1);
194 wpainter.setPen(QColor(75,75,75));
195 wpainter.drawRect(mouseX-4,0,8,renderedImage.height()-1);
199 QString helpText(i18n(
"delta h=%1 s=%2 v=%3 shift h=%4 s=%5 v=%6",
206 wpainter.setPen(QColor(255,255,255));
207 wpainter.drawText(
rect(), helpText);
248 if (e->button() != Qt::LeftButton && e->button() != Qt::RightButton) {
258 KConfigGroup cfg = KSharedConfig::openConfig()->group(
"advancedColorSelector");
260 bool onRightClick = cfg.readEntry(
"shadeSelectorUpdateOnRightClick",
false);
261 bool onLeftClick = cfg.readEntry(
"shadeSelectorUpdateOnLeftClick",
false);
263 bool explicitColorReset =
264 (e->button() == Qt::LeftButton && onLeftClick) ||
265 (e->button() == Qt::RightButton && onRightClick);