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
53 && qFuzzyCompare(QPointF(*
this), QPointF(e));
55 inline bool operator!=(
const Element &e)
const {
return !operator==(e); }
58 QPainterPath()
noexcept;
59 explicit QPainterPath(
const QPointF &startPoint);
60 QPainterPath(
const QPainterPath &other);
61 QPainterPath &operator=(
const QPainterPath &other);
62 QPainterPath(QPainterPath &&other)
noexcept
63 : d_ptr(std::exchange(other.d_ptr,
nullptr))
65 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
68 inline void swap(QPainterPath &other)
noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
71 void reserve(
int size);
76 void moveTo(
const QPointF &p);
77 inline void moveTo(qreal x, qreal y);
79 void lineTo(
const QPointF &p);
80 inline void lineTo(qreal x, qreal y);
82 void arcMoveTo(
const QRectF &rect, qreal angle);
83 inline void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
85 void arcTo(
const QRectF &rect, qreal startAngle, qreal arcLength);
86 inline void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength);
88 void cubicTo(
const QPointF &ctrlPt1,
const QPointF &ctrlPt2,
const QPointF &endPt);
89 inline void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y,
90 qreal endPtx, qreal endPty);
91 void quadTo(
const QPointF &ctrlPt,
const QPointF &endPt);
92 inline void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
94 QPointF currentPosition()
const;
96 void addRect(
const QRectF &rect);
97 inline void addRect(qreal x, qreal y, qreal w, qreal h);
98 void addEllipse(
const QRectF &rect);
99 inline void addEllipse(qreal x, qreal y, qreal w, qreal h);
100 inline void addEllipse(
const QPointF ¢er, qreal rx, qreal ry);
101 void addPolygon(
const QPolygonF &polygon);
102 void addText(
const QPointF &point,
const QFont &f,
const QString &text);
103 inline void addText(qreal x, qreal y,
const QFont &f,
const QString &text);
104 void addPath(
const QPainterPath &path);
105 void addRegion(
const QRegion ®ion);
107 void addRoundedRect(
const QRectF &rect, qreal xRadius, qreal yRadius,
108 Qt::SizeMode mode = Qt::AbsoluteSize);
109 inline void addRoundedRect(qreal x, qreal y, qreal w, qreal h,
110 qreal xRadius, qreal yRadius,
111 Qt::SizeMode mode = Qt::AbsoluteSize);
113 void connectPath(
const QPainterPath &path);
115 bool contains(
const QPointF &pt)
const;
116 bool contains(
const QRectF &rect)
const;
117 bool intersects(
const QRectF &rect)
const;
119 void translate(qreal dx, qreal dy);
120 inline void translate(
const QPointF &offset);
122 [[nodiscard]] QPainterPath translated(qreal dx, qreal dy)
const;
123 [[nodiscard]]
inline QPainterPath translated(
const QPointF &offset)
const;
125 QRectF boundingRect()
const;
126 QRectF controlPointRect()
const;
128 Qt::FillRule fillRule()
const;
129 void setFillRule(Qt::FillRule fillRule);
131 bool isEmpty()
const;
133 [[nodiscard]] QPainterPath toReversed()
const;
135 QList<QPolygonF> toSubpathPolygons(
const QTransform &matrix = QTransform())
const;
136 QList<QPolygonF> toFillPolygons(
const QTransform &matrix = QTransform())
const;
137 QPolygonF toFillPolygon(
const QTransform &matrix = QTransform())
const;
139 int elementCount()
const;
140 QPainterPath::Element elementAt(
int i)
const;
141 void setElementPositionAt(
int i, qreal x, qreal y);
143 bool isCachingEnabled()
const;
144 void setCachingEnabled(
bool enabled);
145 qreal length()
const;
146 qreal percentAtLength(qreal len)
const;
147 QPointF pointAtPercent(qreal t)
const;
148 qreal angleAtPercent(qreal t)
const;
149 qreal slopeAtPercent(qreal t)
const;
150 [[nodiscard]] QPainterPath trimmed(qreal fromFraction, qreal toFraction, qreal offset = 0)
const;
152 bool intersects(
const QPainterPath &p)
const;
153 bool contains(
const QPainterPath &p)
const;
154 [[nodiscard]] QPainterPath united(
const QPainterPath &r)
const;
155 [[nodiscard]] QPainterPath intersected(
const QPainterPath &r)
const;
156 [[nodiscard]] QPainterPath subtracted(
const QPainterPath &r)
const;
158 [[nodiscard]] QPainterPath simplified()
const;
160 bool operator==(
const QPainterPath &other)
const;
161 bool operator!=(
const QPainterPath &other)
const;
163 QPainterPath 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);
168 QPainterPath &operator|=(
const QPainterPath &other);
169 QPainterPath &operator+=(
const QPainterPath &other);
170 QPainterPath &operator-=(
const QPainterPath &other);
173 QPainterPathPrivate *d_ptr;
175 inline void ensureData() {
if (!d_ptr) ensureData_helper(); }
176 void ensureData_helper();
178 void computeBoundingRect()
const;
179 void computeControlPointRect()
const;
181 QPainterPathPrivate *d_func()
const {
return d_ptr; }
183 friend class QPainterPathStroker;
184 friend class QPainterPathStrokerPrivate;
185 friend class QPainterPathPrivate;
186 friend class QTransform;
187 friend class QVectorPath;
188 friend Q_GUI_EXPORT
const QVectorPath &qtVectorPathForPath(
const QPainterPath &);
190#ifndef QT_NO_DATASTREAM
191 friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &,
const QPainterPath &);
192 friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &);