42 bool isMoveTo()
const {
return type == MoveToElement; }
43 bool isLineTo()
const {
return type == LineToElement; }
44 bool isCurveTo()
const {
return type == CurveToElement; }
46 operator QPointF ()
const {
return QPointF(x, y); }
48 bool operator==(
const Element &e)
const {
return qFuzzyCompare(x, e.x)
49 && qFuzzyCompare(y, e.y) && type == e.type; }
50 inline bool operator!=(
const Element &e)
const {
return !operator==(e); }
53 QPainterPath()
noexcept;
54 explicit QPainterPath(
const QPointF &startPoint);
55 QPainterPath(
const QPainterPath &other);
56 QPainterPath &operator=(
const QPainterPath &other);
57 QPainterPath(QPainterPath &&other)
noexcept
58 : d_ptr(std::exchange(other.d_ptr,
nullptr))
60 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
63 inline void swap(QPainterPath &other)
noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
66 void reserve(
int size);
71 void moveTo(
const QPointF &p);
72 inline void moveTo(qreal x, qreal y);
74 void lineTo(
const QPointF &p);
75 inline void lineTo(qreal x, qreal y);
77 void arcMoveTo(
const QRectF &rect, qreal angle);
78 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
80 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
81 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
83 void cubicTo(
const QPointF &ctrlPt1,
const QPointF &ctrlPt2,
const QPointF &endPt);
84 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
85 qreal endPtx, qreal endPty);
86 void quadTo(
const QPointF &ctrlPt,
const QPointF &endPt);
87 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
89 QPointF currentPosition()
const;
91 void addRect(
const QRectF &rect);
92 inline void addRect(qreal x, qreal y, qreal w, qreal h);
93 void addEllipse(
const QRectF &rect);
94 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
95 inline void addEllipse(
const QPointF ¢er, qreal rx, qreal ry);
96 void addPolygon(
const QPolygonF &polygon);
97 void addText(
const QPointF &point,
const QFont &f,
const QString &text);
98 inline void addText(qreal x, qreal y,
const QFont &f,
const QString &text);
99 void addPath(
const QPainterPath &path);
100 void addRegion(
const QRegion ®ion);
102 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
103 Qt::SizeMode mode = Qt::AbsoluteSize);
104 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
105 qreal xRadius, qreal yRadius,
106 Qt::SizeMode mode = Qt::AbsoluteSize);
108 void connectPath(
const QPainterPath &path);
110 bool contains(
const QPointF &pt)
const;
111 bool contains(
const QRectF &rect)
const;
112 bool intersects(
const QRectF &rect)
const;
114 void translate(qreal dx, qreal dy);
115 inline void translate(
const QPointF &offset);
117 [[nodiscard]] QPainterPath translated(qreal dx, qreal dy)
const;
118 [[nodiscard]]
inline QPainterPath translated(
const QPointF &offset)
const;
120 QRectF boundingRect()
const;
121 QRectF controlPointRect()
const;
123 Qt::FillRule fillRule()
const;
124 void setFillRule(Qt::FillRule fillRule);
126 bool isEmpty()
const;
128 [[nodiscard]] QPainterPath toReversed()
const;
130 QList<QPolygonF> toSubpathPolygons(
const QTransform &matrix = QTransform())
const;
131 QList<QPolygonF> toFillPolygons(
const QTransform &matrix = QTransform())
const;
132 QPolygonF toFillPolygon(
const QTransform &matrix = QTransform())
const;
134 int elementCount()
const;
135 QPainterPath::Element elementAt(
int i)
const;
136 void setElementPositionAt(
int i, qreal x, qreal y);
138 bool isCachingEnabled()
const;
139 void setCachingEnabled(
bool enabled);
140 qreal length()
const;
141 qreal percentAtLength(qreal len)
const;
142 QPointF pointAtPercent(qreal t)
const;
143 qreal angleAtPercent(qreal t)
const;
144 qreal slopeAtPercent(qreal t)
const;
145 [[nodiscard]] QPainterPath trimmed(qreal fromFraction, qreal toFraction, qreal offset = 0)
const;
147 bool intersects(
const QPainterPath &p)
const;
148 bool contains(
const QPainterPath &p)
const;
149 [[nodiscard]] QPainterPath united(
const QPainterPath &r)
const;
150 [[nodiscard]] QPainterPath intersected(
const QPainterPath &r)
const;
151 [[nodiscard]] QPainterPath subtracted(
const QPainterPath &r)
const;
153 [[nodiscard]] QPainterPath simplified()
const;
155 bool operator==(
const QPainterPath &other)
const;
156 bool 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)
const;
162 QPainterPath &operator&=(
const QPainterPath &other);
163 QPainterPath &operator|=(
const QPainterPath &other);
164 QPainterPath &operator+=(
const QPainterPath &other);
165 QPainterPath &operator-=(
const QPainterPath &other);
168 QPainterPathPrivate *d_ptr;
170 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
171 void ensureData_helper();
173 void computeBoundingRect()
const;
174 void computeControlPointRect()
const;
176 QPainterPathPrivate *d_func()
const {
return d_ptr; }
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 &);