本文整理汇总了C++中QVectorPath::hints方法的典型用法代码示例。如果您正苦于以下问题:C++ QVectorPath::hints方法的具体用法?C++ QVectorPath::hints怎么用?C++ QVectorPath::hints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVectorPath
的用法示例。
在下文中一共展示了QVectorPath::hints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qt_painterPathFromVectorPath
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
{
const qreal *points = path.points();
const QPainterPath::ElementType *types = path.elements();
QPainterPath p;
if (types) {
int id = 0;
for (int i=0; i<path.elementCount(); ++i) {
switch(types[i]) {
case QPainterPath::MoveToElement:
p.moveTo(QPointF(points[id], points[id+1]));
id+=2;
break;
case QPainterPath::LineToElement:
p.lineTo(QPointF(points[id], points[id+1]));
id+=2;
break;
case QPainterPath::CurveToElement: {
QPointF p1(points[id], points[id+1]);
QPointF p2(points[id+2], points[id+3]);
QPointF p3(points[id+4], points[id+5]);
p.cubicTo(p1, p2, p3);
id+=6;
break;
}
case QPainterPath::CurveToDataElement:
;
break;
}
}
} else {
p.moveTo(QPointF(points[0], points[1]));
int id = 2;
for (int i=1; i<path.elementCount(); ++i) {
p.lineTo(QPointF(points[id], points[id+1]));
id+=2;
}
}
if (path.hints() & QVectorPath::WindingFill)
p.setFillRule(Qt::WindingFill);
return p;
}