44 bool isMoveTo()
const {
return type == MoveToElement; }
45 bool isLineTo()
const {
return type == LineToElement; }
46 bool isCurveTo()
const {
return type == CurveToElement; }
48 operator QPointF ()
const {
return QPointF(x, y); }
50 bool operator==(
const Element &e)
const {
return qFuzzyCompare(x, e.x)
51 && qFuzzyCompare(y, e.y) && type == e.type; }
52 inline bool operator!=(
const Element &e)
const {
return !operator==(e); }
55 QPainterPath()
noexcept;
56 explicit QPainterPath(
const QPointF &startPoint);
57 QPainterPath(
const QPainterPath &other);
58 QPainterPath &operator=(
const QPainterPath &other);
59 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
62 inline void swap(QPainterPath &other)
noexcept { d_ptr.swap(other.d_ptr); }
65 void reserve(
int size);
70 void moveTo(
const QPointF &p);
71 inline void moveTo(qreal x, qreal y);
73 void lineTo(
const QPointF &p);
74 inline void lineTo(qreal x, qreal y);
76 void arcMoveTo(
const QRectF &rect, qreal angle);
77 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
79 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
80 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
82 void cubicTo(
const QPointF &ctrlPt1,
const QPointF &ctrlPt2,
const QPointF &endPt);
83 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
84 qreal endPtx, qreal endPty);
85 void quadTo(
const QPointF &ctrlPt,
const QPointF &endPt);
86 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
88 QPointF currentPosition()
const;
90 void addRect(
const QRectF &rect);
91 inline void addRect(qreal x, qreal y, qreal w, qreal h);
92 void addEllipse(
const QRectF &rect);
93 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
94 inline void addEllipse(
const QPointF ¢er, qreal rx, qreal ry);
95 void addPolygon(
const QPolygonF &polygon);
96 void addText(
const QPointF &point,
const QFont &f,
const QString &text);
97 inline void addText(qreal x, qreal y,
const QFont &f,
const QString &text);
98 void addPath(
const QPainterPath &path);
99 void addRegion(
const QRegion ®ion);
101 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
102 Qt::SizeMode mode = Qt::AbsoluteSize);
103 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
104 qreal xRadius, qreal yRadius,
105 Qt::SizeMode mode = Qt::AbsoluteSize);
107 void connectPath(
const QPainterPath &path);
109 bool contains(
const QPointF &pt)
const;
110 bool contains(
const QRectF &rect)
const;
111 bool intersects(
const QRectF &rect)
const;
113 void translate(qreal dx, qreal dy);
114 inline void translate(
const QPointF &offset);
116 [[nodiscard]] QPainterPath translated(qreal dx, qreal dy)
const;
117 [[nodiscard]]
inline QPainterPath translated(
const QPointF &offset)
const;
119 QRectF boundingRect()
const;
120 QRectF controlPointRect()
const;
122 Qt::FillRule fillRule()
const;
123 void setFillRule(Qt::FillRule fillRule);
125 bool isEmpty()
const;
127 [[nodiscard]] QPainterPath toReversed()
const;
129 QList<QPolygonF> toSubpathPolygons(
const QTransform &matrix = QTransform())
const;
130 QList<QPolygonF> toFillPolygons(
const QTransform &matrix = QTransform())
const;
131 QPolygonF toFillPolygon(
const QTransform &matrix = QTransform())
const;
133 int elementCount()
const;
134 QPainterPath::Element elementAt(
int i)
const;
135 void setElementPositionAt(
int i, qreal x, qreal y);
137 bool isCachingEnabled()
const;
138 void setCachingEnabled(
bool enabled);
139 qreal length()
const;
140 qreal percentAtLength(qreal len)
const;
141 QPointF pointAtPercent(qreal t)
const;
142 qreal angleAtPercent(qreal t)
const;
143 qreal slopeAtPercent(qreal t)
const;
144 [[nodiscard]] QPainterPath trimmed(qreal f1, qreal f2, qreal offset = 0)
const;
146 bool intersects(
const QPainterPath &p)
const;
147 bool contains(
const QPainterPath &p)
const;
148 [[nodiscard]] QPainterPath united(
const QPainterPath &r)
const;
149 [[nodiscard]] QPainterPath intersected(
const QPainterPath &r)
const;
150 [[nodiscard]] QPainterPath subtracted(
const QPainterPath &r)
const;
152 [[nodiscard]] QPainterPath simplified()
const;
154 bool operator==(
const QPainterPath &other)
const;
155 bool operator!=(
const QPainterPath &other)
const;
157 QPainterPath operator&(
const QPainterPath &other)
const;
158 QPainterPath operator|(
const QPainterPath &other)
const;
159 QPainterPath operator+(
const QPainterPath &other)
const;
160 QPainterPath operator-(
const QPainterPath &other)
const;
161 QPainterPath &operator&=(
const QPainterPath &other);
162 QPainterPath &operator|=(
const QPainterPath &other);
163 QPainterPath &operator+=(
const QPainterPath &other);
164 QPainterPath &operator-=(
const QPainterPath &other);
167 QExplicitlySharedDataPointer<QPainterPathPrivate> d_ptr;
169 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
170 void ensureData_helper();
173 void computeBoundingRect()
const;
174 void computeControlPointRect()
const;
176 QPainterPathPrivate *d_func()
const {
return d_ptr.data(); }
178 friend class QPainterPathStroker;
179 friend class QPainterPathStrokerPrivate;
180 friend class QPainterPathPrivate;
181 friend class QTransform;
182 friend class QVectorPath;
183 friend Q_GUI_EXPORT
const QVectorPath &qtVectorPathForPath(
const QPainterPath &);
185#ifndef QT_NO_DATASTREAM
186 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QPainterPath &);
187 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);