本文整理汇总了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));
}
}
}
示例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));
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
示例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"));
}