void ColorWheel::resizeEvent(QResizeEvent *event) { m_wheelPixmap = QPixmap(event->size()); m_wheelPixmap.fill(palette().background().color()); drawWheelImage(event->size()); drawSquareImage(m_currentColor.hue()); update(); }
void ColorWheel::hueChanged(const int &hue) { if ( hue < 0 || hue > 359) { return; } int s = m_currentColor.saturation(); int v = m_currentColor.value(); m_currentColor.setHsv(hue, s, v); if(!isVisible()) { return; } drawSquareImage(hue); repaint(); emit colorChanged(m_currentColor); }
void ColorWheel::setColor(QColor color) { // this is a UI updating function, never emit any signals // and don't call any functions that will emit signals color = color.toHsv(); if (color == mCurrentColor) { return; } if (color.hue() == -1) // grayscale color, keep the current hue { color.setHsv(mCurrentColor.hue(), color.saturation(), color.value(), color.alpha()); } mCurrentColor = color; drawSquareImage(color.hue()); update(); }
void ColorWheel::hueChanged(const int &hue) { if (hue < 0 || hue > 359) { return; } int s = mCurrentColor.hsvSaturation(); int v = mCurrentColor.value(); int a = mCurrentColor.alpha(); mCurrentColor.setHsv(hue, s, v, a); if (!isVisible()) { return; } drawSquareImage(hue); update(); emit colorChanged(mCurrentColor); }