当前位置: 首页>>代码示例>>C++>>正文


C++ KoColor::toQColor方法代码示例

本文整理汇总了C++中KoColor::toQColor方法的典型用法代码示例。如果您正苦于以下问题:C++ KoColor::toQColor方法的具体用法?C++ KoColor::toQColor怎么用?C++ KoColor::toQColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KoColor的用法示例。


在下文中一共展示了KoColor::toQColor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mouseMoveEvent

void KisColorPatches::mouseMoveEvent(QMouseEvent *event)
{
    event->ignore();
    KisColorSelectorBase::mouseMoveEvent(event);
    if(event->isAccepted())
        return;

    if (!(event->buttons() & Qt::LeftButton))
        return;
    if ((event->pos() - m_dragStartPos).manhattanLength()
         < QApplication::startDragDistance())
        return;

    KoColor koColor;
    if(!colorAt(m_dragStartPos, &koColor))
        return;

    QDrag *drag = new QDrag(this);
    QMimeData *mimeData = new QMimeData;

    QColor color = koColor.toQColor();
    mimeData->setColorData(color);
    mimeData->setText(color.name());
    drag->setMimeData(mimeData);

    drag->exec(Qt::CopyAction);

    event->accept();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:29,代码来源:kis_color_patches.cpp

示例2: hsvComparison

    /*compares c1 and c2 based on HSV.
      c1 < c2, returns -1
      c1 = c2, returns 0
      c1 > c2, returns 1 */
    int hsvComparison(const KoColor& c1, const KoColor& c2) {
        QColor qc1 = c1.toQColor();
        QColor qc2 = c2.toQColor();

        if (qc1.hue() < qc2.hue()) return -1;
        if (qc1.hue() > qc2.hue()) return 1;

        // hue is the same, ok let's compare saturation
        if (qc1.saturation() < qc2.saturation()) return -1;
        if (qc1.saturation() > qc2.saturation()) return 1;

        // oh, also saturation is same?
        if (qc1.value() < qc2.value()) return -1;
        if (qc1.value() > qc2.value()) return 1;

        // user selected two similar colors
        return 0;
    }
开发者ID:hshrimali,项目名称:krita,代码行数:22,代码来源:kis_favorite_resource_manager.cpp

示例3: getColorFromConverter

QColor KisVisualColorSelectorShape::getColorFromConverter(KoColor c){
    QColor col;
    KoColor color = c;
    if (m_d->displayRenderer) {
        color.convertTo(m_d->displayRenderer->getPaintingColorSpace());
        col = m_d->displayRenderer->toQColor(c);
    } else {
        col = c.toQColor();
    }
    return col;
}
开发者ID:KDE,项目名称:krita,代码行数:11,代码来源:KisVisualColorSelectorShape.cpp

示例4: slotDrawLine

void KisBrightnessContrastConfigWidget::slotDrawLine(const KoColor &color)
{
    QColor colorNew = color.toQColor();
    int i = (colorNew.red() + colorNew.green() + colorNew.blue())/3 ;
    QPixmap pix = m_page->curveWidget->getBasePixmap();
    QPainter p(&pix);
    p.setPen(QPen(Qt::black, 1, Qt::SolidLine));
    p.drawLine(i,0,i,255);
    QString label = "x:";
    label.insert(2,QString(QString::number(i)));
    p.drawText(i,250,label);
    m_page->curveWidget->setPixmap(pix);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:13,代码来源:kis_brightness_contrast_filter.cpp

示例5: mousePressEvent

void KisColorPatches::mousePressEvent(QMouseEvent *event)
{
    KoColor koColor;
    if(!colorAt(event->pos(), &koColor))
        return;

    KisColorSelectorBase::mousePressEvent(event);
    if(event->isAccepted())
        return;

    updateColorPreview(koColor.toQColor());

    if (event->button() == Qt::LeftButton)
        m_dragStartPos = event->pos();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:15,代码来源:kis_color_patches.cpp

示例6: drawContents

void KoColorSlider::drawContents( QPainter *painter )
{
    QPixmap checker(8, 8);
    QPainter p(&checker);
    p.fillRect(0, 0, 4, 4, Qt::lightGray);
    p.fillRect(4, 0, 4, 4, Qt::darkGray);
    p.fillRect(0, 4, 4, 4, Qt::darkGray);
    p.fillRect(4, 4, 4, 4, Qt::lightGray);
    p.end();
    QRect contentsRect_(contentsRect());
    painter->fillRect(contentsRect_, QBrush(checker));

    if( !d->upToDate || d->pixmap.isNull() || d->pixmap.width() != contentsRect_.width()
        || d->pixmap.height() != contentsRect_.height() )
    {
        KoColor c = d->minColor; // smart way to fetch colorspace
        QColor color;

        const quint8 *colors[2];
        colors[0] = d->minColor.data();
        colors[1] = d->maxColor.data();

        KoMixColorsOp * mixOp = c.colorSpace()->mixColorsOp();

        QImage image(contentsRect_.width(), contentsRect_.height(), QImage::Format_ARGB32 );

        if( orientation() == Qt::Horizontal ) {
            for (int x = 0; x < contentsRect_.width(); x++) {

                qreal t = static_cast<qreal>(x) / (contentsRect_.width() - 1);

                qint16 colorWeights[2];
                colorWeights[0] = static_cast<quint8>((1.0 - t) * 255 + 0.5);
                colorWeights[1] = 255 - colorWeights[0];

                mixOp->mixColors(colors, colorWeights, 2, c.data());

                c.toQColor(&color);

                for (int y = 0; y < contentsRect_.height(); y++)
                image.setPixel(x, y, color.rgba());
            }
        }
        else {
            for (int y = 0; y < contentsRect_.height(); y++) {

                qreal t = static_cast<qreal>(y) / (contentsRect_.height() - 1);

                qint16 colorWeights[2];
                colorWeights[0] = static_cast<quint8>((t) * 255 + 0.5);
                colorWeights[1] = 255 - colorWeights[0];

                mixOp->mixColors(colors, colorWeights, 2, c.data());

                c.toQColor(&color);

                for (int x = 0; x < contentsRect_.width(); x++)
                image.setPixel(x, y, color.rgba());
            }
        }
        d->pixmap = QPixmap::fromImage(image);
        d->upToDate = true;
    }
    painter->drawPixmap( contentsRect_, d->pixmap, QRect( 0, 0, d->pixmap.width(), d->pixmap.height()) );
}
开发者ID:KDE,项目名称:koffice,代码行数:65,代码来源:KoColorSlider.cpp

示例7: setBorderColor

void SimpleTableWidget::setBorderColor(const KoColor &koColor)
{
    fillBorderButton(koColor.toQColor());
}
开发者ID:KDE,项目名称:calligra,代码行数:4,代码来源:SimpleTableWidget.cpp


注:本文中的KoColor::toQColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。