Ejemplo n.º 1
0
void ColorWheel::composeWheel(QPixmap& pixmap)
{
    QPainter composePainter(&pixmap);
    composePainter.drawImage(0, 0, mWheelImage);
    composePainter.drawImage(mSquareRect, mSquareImage);
    composePainter.end();
    drawHueIndicator(mCurrentColor.hsvHue());
    drawPicker(mCurrentColor);
}
Ejemplo n.º 2
0
void ColorWheel::composeWheel( QPixmap& pixmap )
{
    QPainter composePainter(&pixmap);
    composePainter.drawImage(0, 0, m_wheelImage);
    composePainter.drawImage(m_squareRegion.boundingRect().topLeft(), m_squareImage);
    composePainter.end();
    drawHueIndicator(m_currentColor.hue());
    drawPicker(m_currentColor);
}
Ejemplo n.º 3
0
void ColorWheel::resizeEvent(QResizeEvent *event)
{
    wheel = QPixmap(event->size());
    wheel.fill(palette().background().color());
    drawWheel(event->size());
    drawSquare(current.hue());
    drawIndicator(current.hue());
    drawPicker(current);
    update();
}
Ejemplo n.º 4
0
void ColorWheel::svChanged(const QColor &newcolor)
{
    int hue = current.hue();
    current.setHsv(hue, newcolor.saturation(), newcolor.value());
    if(!isVisible()) return;
    drawWheel(size());
    drawSquare(hue);
    drawIndicator(hue);
    drawPicker(newcolor);
    repaint();
    emit colorChange(current);
}
Ejemplo n.º 5
0
void ColorWheel::hueChanged(const int &hue)
{
    if( hue<0 ||hue>359)return;
    int s = current.saturation();
    int v = current.value();
    current.setHsv(hue, s, v);
    if(!isVisible()) return;
    drawWheel(size());
    drawSquare(hue);
    drawIndicator(hue);
    drawPicker(current);
    repaint();
    emit colorChange(current);
}
Ejemplo n.º 6
0
void NQColorWheel::paintEvent(QPaintEvent * /* e */)
{
    QPainter painter(this);

    QStyleOption opt;
    opt.initFrom(this);

    QPainter composePainter(&pixmapWheel_);
    composePainter.drawImage(0, 0, imageWheel_);
    composePainter.drawImage(regionSquare_.boundingRect().topLeft(), imageSquare_);
    composePainter.end();
    drawIndicator(currentColor_.hue());
    drawPicker(currentColor_);

    painter.drawPixmap(0, 0, pixmapWheel_);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
}
Ejemplo n.º 7
0
void ColorWheel::paintEvent(QPaintEvent*) {
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    QStyleOption opt;    
    opt.initFrom(this);
    // use the following lines to obtain the background color of the widget
    //QBrush background = opt.palette.window();
    //wheel.fill(background.color());

    drawOuterRing(painter);
    painter.drawImage(squareRegion_.boundingRect(), squareImage_);

    drawIndicator(painter);
    drawPicker(painter);

    style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
}