本文整理汇总了C++中QPainterPath::toFillPolygons方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainterPath::toFillPolygons方法的具体用法?C++ QPainterPath::toFillPolygons怎么用?C++ QPainterPath::toFillPolygons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPainterPath
的用法示例。
在下文中一共展示了QPainterPath::toFillPolygons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testToFillPolygons
void tst_QPainterPath::testToFillPolygons()
{
QPainterPath path;
path.lineTo(QPointF(0, 50));
path.lineTo(QPointF(50, 50));
path.moveTo(QPointF(70, 50));
path.lineTo(QPointF(70, 100));
path.lineTo(QPointF(40, 100));
const QList<QPolygonF> polygons = path.toFillPolygons();
QCOMPARE(polygons.size(), 2);
QCOMPARE(polygons.first().count(QPointF(70, 50)), 0);
}
示例2:
QList<QPointF> Geometry::pathToPoints(QPainterPath const &path)
{
qreal const polygonIsPointCondition = 0.001;
QList<QPolygonF> polygons = path.toFillPolygons();
QList<QPointF> result;
foreach (QPolygonF const &polygon, polygons) {
if (square(polygon) < polygonIsPointCondition) {
result << polygon[0];
} else {
return QList<QPointF>();
}
}
return result;
}