45 bool isMoveTo()
const {
return type == MoveToElement; }
46 bool isLineTo()
const {
return type == LineToElement; }
47 bool isCurveTo()
const {
return type == CurveToElement; }
49 operator QPointF ()
const {
return QPointF(x, y); }
51 bool operator==(
const Element &e)
const
54 && qFuzzyCompare(QPointF(*
this), QPointF(e));
56 inline bool operator!=(
const Element &e)
const {
return !operator==(e); }
59 QPainterPath()
noexcept;
60 explicit QPainterPath(
const QPointF &startPoint);
61 QPainterPath(
const QPainterPath &other);
62 QPainterPath &operator=(
const QPainterPath &other);
63 QPainterPath(QPainterPath &&other)
noexcept
64 : d_ptr(std::exchange(other.d_ptr,
nullptr))
66 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
69 inline void swap(QPainterPath &other)
noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
72 void reserve(
int size);
77 void moveTo(
const QPointF &p);
78 inline void moveTo(qreal x, qreal y);
80 void lineTo(
const QPointF &p);
81 inline void lineTo(qreal x, qreal y);
83 void arcMoveTo(
const QRectF &rect, qreal angle);
84 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
86 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
87 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
89 void cubicTo(
const QPointF &ctrlPt1,
const QPointF &ctrlPt2,
const QPointF &endPt);
90 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
91 qreal endPtx, qreal endPty);
92 void quadTo(
const QPointF &ctrlPt,
const QPointF &endPt);
93 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
95 QPointF currentPosition()
const;
97 void addRect(
const QRectF &rect);
98 inline void addRect(qreal x, qreal y, qreal w, qreal h);
99 void addEllipse(
const QRectF &rect);
100 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
101 inline void addEllipse(
const QPointF ¢er, qreal rx, qreal ry);
102 void addPolygon(
const QPolygonF &polygon);
103 void addText(
const QPointF &point,
const QFont &f,
const QString &text);
104 inline void addText(qreal x, qreal y,
const QFont &f,
const QString &text);
105 void addPath(
const QPainterPath &path);
106 void addRegion(
const QRegion ®ion);
108 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
109 Qt::SizeMode mode = Qt::AbsoluteSize);
110 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
111 qreal xRadius, qreal yRadius,
112 Qt::SizeMode mode = Qt::AbsoluteSize);
114 void connectPath(
const QPainterPath &path);
116 bool contains(
const QPointF &pt)
const;
117 bool contains(
const QRectF &rect)
const;
118 bool intersects(
const QRectF &rect)
const;
120 void translate(qreal dx, qreal dy);
121 inline void translate(
const QPointF &offset);
123 [[nodiscard]] QPainterPath translated(qreal dx, qreal dy)
const;
124 [[nodiscard]]
inline QPainterPath translated(
const QPointF &offset)
const;
126 QRectF boundingRect()
const;
127 QRectF controlPointRect()
const;
129 Qt::FillRule fillRule()
const;
130 void setFillRule(Qt::FillRule fillRule);
132 bool isEmpty()
const;
134 [[nodiscard]] QPainterPath toReversed()
const;
136 QList<QPolygonF> toSubpathPolygons(
const QTransform &matrix = QTransform())
const;
137 QList<QPolygonF> toFillPolygons(
const QTransform &matrix = QTransform())
const;
138 QPolygonF toFillPolygon(
const QTransform &matrix = QTransform())
const;
140 int elementCount()
const;
141 QPainterPath::Element elementAt(
int i)
const;
142 void setElementPositionAt(
int i, qreal x, qreal y);
144 bool isCachingEnabled()
const;
145 void setCachingEnabled(
bool enabled);
146 qreal length()
const;
147 qreal percentAtLength(qreal len)
const;
148 QPointF pointAtPercent(qreal t)
const;
149 qreal angleAtPercent(qreal t)
const;
150 qreal slopeAtPercent(qreal t)
const;
151 [[nodiscard]] QPainterPath trimmed(qreal fromFraction, qreal toFraction, qreal offset = 0)
const;
153 bool intersects(
const QPainterPath &p)
const;
154 bool contains(
const QPainterPath &p)
const;
155 [[nodiscard]] QPainterPath united(
const QPainterPath &r)
const;
156 [[nodiscard]] QPainterPath intersected(
const QPainterPath &r)
const;
157 [[nodiscard]] QPainterPath subtracted(
const QPainterPath &r)
const;
159 [[nodiscard]] QPainterPath simplified()
const;
161 bool operator==(
const QPainterPath &other)
const;
162 bool operator!=(
const QPainterPath &other)
const;
164 QPainterPath operator&(
const QPainterPath &other)
const;
165 QPainterPath 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);
169 QPainterPath &operator|=(
const QPainterPath &other);
170 QPainterPath &operator+=(
const QPainterPath &other);
171 QPainterPath &operator-=(
const QPainterPath &other);
174 QPainterPathPrivate *d_ptr;
176 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
177 void ensureData_helper();
179 void computeBoundingRect()
const;
180 void computeControlPointRect()
const;
182 QPainterPathPrivate *d_func()
const {
return d_ptr; }
184 friend class QPainterPathStroker;
185 friend class QPainterPathStrokerPrivate;
186 friend class QPainterPathPrivate;
187 friend class QTransform;
188 friend class QVectorPath;
189 friend Q_GUI_EXPORT
const QVectorPath &qtVectorPathForPath(
const QPainterPath &);
191#ifndef QT_NO_DATASTREAM
192 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QPainterPath &);
193 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);