46 bool isMoveTo()
const {
return type == MoveToElement; }
47 bool isLineTo()
const {
return type == LineToElement; }
48 bool isCurveTo()
const {
return type == CurveToElement; }
50 operator QPointF ()
const {
return QPointF(x, y); }
52 bool operator==(
const Element &e)
const
55 && qFuzzyCompare(QPointF(*
this), QPointF(e));
57 inline bool operator!=(
const Element &e)
const {
return !operator==(e); }
60 QPainterPath()
noexcept;
61 explicit QPainterPath(
const QPointF &startPoint);
62 QPainterPath(
const QPainterPath &other);
63 QPainterPath &operator=(
const QPainterPath &other);
64 QPainterPath(QPainterPath &&other)
noexcept
65 : d_ptr(std::exchange(other.d_ptr,
nullptr))
67 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
70 inline void swap(QPainterPath &other)
noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
73 void reserve(
int size);
78 void moveTo(
const QPointF &p);
79 inline void moveTo(qreal x, qreal y);
81 void lineTo(
const QPointF &p);
82 inline void lineTo(qreal x, qreal y);
84 void arcMoveTo(
const QRectF &rect, qreal angle);
85 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
87 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
88 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
90 void cubicTo(
const QPointF &ctrlPt1,
const QPointF &ctrlPt2,
const QPointF &endPt);
91 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
92 qreal endPtx, qreal endPty);
93 void quadTo(
const QPointF &ctrlPt,
const QPointF &endPt);
94 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
96 QPointF currentPosition()
const;
98 void addRect(
const QRectF &rect);
99 inline void addRect(qreal x, qreal y, qreal w, qreal h);
100 void addEllipse(
const QRectF &rect);
101 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
102 inline void addEllipse(
const QPointF ¢er, qreal rx, qreal ry);
103 void addPolygon(
const QPolygonF &polygon);
104 void addText(
const QPointF &point,
const QFont &f,
const QString &text);
105 inline void addText(qreal x, qreal y,
const QFont &f,
const QString &text);
106 void addPath(
const QPainterPath &path);
107 void addRegion(
const QRegion ®ion);
109 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
110 Qt::SizeMode mode = Qt::AbsoluteSize);
111 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
112 qreal xRadius, qreal yRadius,
113 Qt::SizeMode mode = Qt::AbsoluteSize);
115 void connectPath(
const QPainterPath &path);
117 bool contains(
const QPointF &pt)
const;
118 bool contains(
const QRectF &rect)
const;
119 bool intersects(
const QRectF &rect)
const;
121 void translate(qreal dx, qreal dy);
122 inline void translate(
const QPointF &offset);
124 [[nodiscard]] QPainterPath translated(qreal dx, qreal dy)
const;
125 [[nodiscard]]
inline QPainterPath translated(
const QPointF &offset)
const;
127 QRectF boundingRect()
const;
128 QRectF controlPointRect()
const;
130 Qt::FillRule fillRule()
const;
131 void setFillRule(Qt::FillRule fillRule);
133 bool isEmpty()
const;
135 [[nodiscard]] QPainterPath toReversed()
const;
137 QList<QPolygonF> toSubpathPolygons(
const QTransform &matrix = QTransform())
const;
138 QList<QPolygonF> toFillPolygons(
const QTransform &matrix = QTransform())
const;
139 QPolygonF toFillPolygon(
const QTransform &matrix = QTransform())
const;
141 QSpan<
const Element> elements()
const noexcept;
142 int elementCount()
const;
143 QPainterPath::Element elementAt(
int i)
const;
144 void setElementPositionAt(
int i, qreal x, qreal y);
146 bool isCachingEnabled()
const;
147 void setCachingEnabled(
bool enabled);
148 qreal length()
const;
149 qreal percentAtLength(qreal len)
const;
150 QPointF pointAtPercent(qreal t)
const;
151 qreal angleAtPercent(qreal t)
const;
152 qreal slopeAtPercent(qreal t)
const;
153 [[nodiscard]] QPainterPath trimmed(qreal fromFraction, qreal toFraction, qreal offset = 0)
const;
155 bool intersects(
const QPainterPath &p)
const;
156 bool contains(
const QPainterPath &p)
const;
157 [[nodiscard]] QPainterPath united(
const QPainterPath &r)
const;
158 [[nodiscard]] QPainterPath intersected(
const QPainterPath &r)
const;
159 [[nodiscard]] QPainterPath subtracted(
const QPainterPath &r)
const;
161 [[nodiscard]] QPainterPath simplified()
const;
163 bool operator==(
const QPainterPath &other)
const;
164 bool operator!=(
const QPainterPath &other)
const;
166 QPainterPath operator&(
const QPainterPath &other)
const;
167 QPainterPath operator|(
const QPainterPath &other)
const;
168 QPainterPath operator+(
const QPainterPath &other)
const;
169 QPainterPath operator-(
const QPainterPath &other)
const;
170 QPainterPath &operator&=(
const QPainterPath &other);
171 QPainterPath &operator|=(
const QPainterPath &other);
172 QPainterPath &operator+=(
const QPainterPath &other);
173 QPainterPath &operator-=(
const QPainterPath &other);
176 QPainterPathPrivate *d_ptr;
178 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
179 void ensureData_helper();
181 void computeBoundingRect()
const;
182 void computeControlPointRect()
const;
184 QPainterPathPrivate *d_func()
const {
return d_ptr; }
186 friend class QPainterPathStroker;
187 friend class QPainterPathStrokerPrivate;
188 friend class QPainterPathPrivate;
189 friend class QTransform;
190 friend class QVectorPath;
191 friend Q_GUI_EXPORT
const QVectorPath &qtVectorPathForPath(
const QPainterPath &);
193#ifndef QT_NO_DATASTREAM
194 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QPainterPath &);
195 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);