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


C++ Style::color方法代码示例

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


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

示例1: points

void asciimage::Shape::renderLine(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::LINE);
    Q_ASSERT(points().size() == 2);

    if (scale == 1)
    {
        if (!isStraightLine())
        {
            painter->setRenderHint(QPainter::Antialiasing, true);
        }
        painter->setPen(style.color());
        painter->drawLine(points()[0], points()[1]);
    }
    else
    {
        if (isStraightLine())
        {
            const QRect b = boundingRect();
            painter->setPen(style.color());
            painter->setBrush(style.color());
            painter->drawRect(scaledOuterRect(b, scale));
        }
        else
        {
            painter->setRenderHint(QPainter::Antialiasing, true);
            painter->setPen(QPen(style.color(), scale, Qt::SolidLine, Qt::SquareCap));
            painter->drawLine(p(points()[0], scale), p(points()[1], scale));
        }
    }
}
开发者ID:bradparks,项目名称:QtAsciimage,代码行数:31,代码来源:shape.cpp

示例2:

void asciimage::Shape::renderPoint(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::POINT);
    Q_ASSERT(points().size() == 1);

    if (scale == 1)
    {
        painter->setPen(style.color());
        painter->drawPoint(points().first());
    }
    else
    {
        painter->setPen(style.color());
        painter->setBrush(style.color());
        painter->drawRect(scaledOuterRect(boundingRect(), scale));
    }
}
开发者ID:bradparks,项目名称:QtAsciimage,代码行数:17,代码来源:shape.cpp

示例3: boundingRect

void asciimage::Shape::renderEllipse(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::ELLIPSE);
    Q_ASSERT(points().size() >= 3);

    painter->setRenderHint(QPainter::Antialiasing, true);

    const QRect rect = boundingRect();

    if (style.isFilled())
    {
        painter->setPen(style.color());
        painter->setBrush(style.color());
        painter->drawEllipse(scaledOuterRect(rect, scale).adjusted(0,0,1,1));
    }
    else
    {
        painter->setPen(QPen(style.color(), scale));
        painter->drawEllipse(QRectF(scaledOuterRect(rect, scale).adjusted(0, 0, 1, 1)).adjusted(0.5 * scale, 0.5 * scale, -0.5 * scale, -0.5 * scale));
    }
}
开发者ID:bradparks,项目名称:QtAsciimage,代码行数:21,代码来源:shape.cpp

示例4: renderLines

void asciimage::Shape::renderPolygon(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::POLYGON);

    if (!style.isClosed())
    {
        renderLines(painter, scale, style);
        return;
    }

    Q_ASSERT(points().size() >= 3);

    if (isRectangle() && style.isFilled())
    {
        const QRect b = boundingRect();
        painter->setPen(style.color());
        painter->setBrush(style.color());
        painter->drawRect(scaledOuterRect(b, scale));
    }
    else
    {
        QPolygonF poly;
        for (const QPoint& point : points())
        {
            poly << p(point, scale);
        }
        poly << p(points().first(), scale);

        painter->setRenderHint(QPainter::Antialiasing, true);
        painter->setPen(QPen(style.color(), scale, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
        if (style.isFilled())
        {
            painter->setBrush(style.color());
        }
        painter->drawPolygon(poly);
    }
}
开发者ID:bradparks,项目名称:QtAsciimage,代码行数:37,代码来源:shape.cpp

示例5: p

void asciimage::Shape::renderLines(QPainter* painter, int scale, const Style& style) const
{
    Q_ASSERT(type() == Type::POLYGON);
    Q_ASSERT(points().size() >= 2);
    Q_ASSERT(!style.isClosed());

    QPolygonF lines;
    for (const QPoint& point : points())
    {
        lines << p(point, scale);
    }

    painter->setRenderHint(QPainter::Antialiasing, true);
    painter->setPen(QPen(style.color(), scale, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin));
    painter->drawPolyline(lines);
}
开发者ID:bradparks,项目名称:QtAsciimage,代码行数:16,代码来源:shape.cpp

示例6: drag

QPointF DragLine::drag(QGraphicsScene *scene, QPointF p0, Style const &s) {
  return drag(scene, p0, s.real("drag-line-width"),
	      s.color("drag-line-color"));
}
开发者ID:wagenadl,项目名称:eln,代码行数:4,代码来源:DragLine.cpp


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