- QPainterPath 中的 Path 可以理解为组成图形轮廓的线条。QPainterPath的对象是通过创建边界线的轨迹而形成的一个图形。
- 该对象交由 QPainter 类进行绘制
概述
示例
QPainterPath path
path.moveTo(20, 80)
path.lineTo(20, 30)
// 添加三次方贝赛尔曲线
path.cubicTo(80, 0, 50, 50, 80, 80)
QPainter painter(this)
// 此处的path可多次使用
painter.drawPath(path)
详解
组成一个 QPainterPath
- 创建一个 QPainterPath 对象,你可以使用空 Path、起点、或对象拷贝。
添加线条
lineTo();
arcTo();
cubicTo();
quadTo();
添加闭合线条(区域)
addEllipse();
addPath();
addRect();
addRegion();
addText();
addPolygon();
填充轮廓
QPainterPathStroker
使轮廓内的元素逆序
QPainterPath QPainterPath::toReversed() const