203 Q_PROPERTY(qreal control1X READ control1X WRITE setControl1X NOTIFY control1XChanged)
204 Q_PROPERTY(qreal control1Y READ control1Y WRITE setControl1Y NOTIFY control1YChanged)
205 Q_PROPERTY(qreal control2X READ control2X WRITE setControl2X NOTIFY control2XChanged)
206 Q_PROPERTY(qreal control2Y READ control2Y WRITE setControl2Y NOTIFY control2YChanged)
207 Q_PROPERTY(qreal relativeControl1X READ relativeControl1X WRITE setRelativeControl1X NOTIFY relativeControl1XChanged)
208 Q_PROPERTY(qreal relativeControl1Y READ relativeControl1Y WRITE setRelativeControl1Y NOTIFY relativeControl1YChanged)
209 Q_PROPERTY(qreal relativeControl2X READ relativeControl2X WRITE setRelativeControl2X NOTIFY relativeControl2XChanged)
210 Q_PROPERTY(qreal relativeControl2Y READ relativeControl2Y WRITE setRelativeControl2Y NOTIFY relativeControl2YChanged)
211 QML_NAMED_ELEMENT(PathCubic)
212 QML_ADDED_IN_VERSION(2, 0)
214 QQuickPathCubic(QObject *parent=
nullptr) : QQuickCurve(parent) {}
216 qreal control1X()
const;
217 void setControl1X(qreal x);
219 qreal control1Y()
const;
220 void setControl1Y(qreal y);
222 qreal control2X()
const;
223 void setControl2X(qreal x);
225 qreal control2Y()
const;
226 void setControl2Y(qreal y);
228 qreal relativeControl1X()
const;
229 void setRelativeControl1X(qreal x);
230 bool hasRelativeControl1X();
232 qreal relativeControl1Y()
const;
233 void setRelativeControl1Y(qreal y);
234 bool hasRelativeControl1Y();
236 qreal relativeControl2X()
const;
237 void setRelativeControl2X(qreal x);
238 bool hasRelativeControl2X();
240 qreal relativeControl2Y()
const;
241 void setRelativeControl2Y(qreal y);
242 bool hasRelativeControl2Y();
244 void addToPath(QPainterPath &path,
const QQuickPathData &) override;
247 void control1XChanged();
248 void control1YChanged();
249 void control2XChanged();
250 void control2YChanged();
251 void relativeControl1XChanged();
252 void relativeControl1YChanged();
253 void relativeControl2XChanged();
254 void relativeControl2YChanged();
257 qreal _control1X = 0;
258 qreal _control1Y = 0;
259 qreal _control2X = 0;
260 qreal _control2Y = 0;
261 QQmlNullableValue<qreal> _relativeControl1X;
262 QQmlNullableValue<qreal> _relativeControl1Y;
263 QQmlNullableValue<qreal> _relativeControl2X;
264 QQmlNullableValue<qreal> _relativeControl2Y;
413 Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL)
414 Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL)
415 Q_PROPERTY(qreal strokeAdjustment READ strokeAdjustment WRITE setStrokeAdjustment NOTIFY strokeAdjustmentChanged FINAL)
416 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
417 Q_PROPERTY(qreal topLeftRadius READ topLeftRadius WRITE setTopLeftRadius RESET resetTopLeftRadius NOTIFY topLeftRadiusChanged FINAL)
418 Q_PROPERTY(qreal topRightRadius READ topRightRadius WRITE setTopRightRadius NOTIFY topRightRadiusChanged RESET resetTopRightRadius FINAL)
419 Q_PROPERTY(qreal bottomLeftRadius READ bottomLeftRadius WRITE setBottomLeftRadius NOTIFY bottomLeftRadiusChanged RESET resetBottomLeftRadius FINAL)
420 Q_PROPERTY(qreal bottomRightRadius READ bottomRightRadius WRITE setBottomRightRadius NOTIFY bottomRightRadiusChanged RESET resetBottomRightRadius FINAL)
421 Q_PROPERTY(
bool bevel READ hasBevel WRITE setBevel NOTIFY bevelChanged FINAL REVISION(6, 10))
422 Q_PROPERTY(
bool topLeftBevel READ hasTopLeftBevel WRITE setTopLeftBevel NOTIFY topLeftBevelChanged RESET resetTopLeftBevel FINAL REVISION(6, 10))
423 Q_PROPERTY(
bool topRightBevel READ hasTopRightBevel WRITE setTopRightBevel NOTIFY topRightBevelChanged RESET resetTopRightBevel FINAL REVISION(6, 10))
424 Q_PROPERTY(
bool bottomLeftBevel READ hasBottomLeftBevel WRITE setBottomLeftBevel NOTIFY bottomLeftBevelChanged RESET resetBottomLeftBevel FINAL REVISION(6, 10))
425 Q_PROPERTY(
bool bottomRightBevel READ hasBottomRightBevel WRITE setBottomRightBevel NOTIFY bottomRightBevelChanged RESET resetBottomRightBevel FINAL REVISION(6, 10))
426 Q_PROPERTY(CornerShape cornerShape READ cornerShape WRITE setCornerShape NOTIFY
427 cornerShapeChanged REVISION(6, 13))
428 Q_PROPERTY(CornerShape topLeftCornerShape READ topLeftCornerShape WRITE setTopLeftCornerShape
429 RESET resetTopLeftCornerShape NOTIFY topLeftCornerShapeChanged REVISION(6,
431 Q_PROPERTY(CornerShape topRightCornerShape READ topRightCornerShape WRITE setTopRightCornerShape
432 RESET resetTopRightCornerShape NOTIFY topRightCornerShapeChanged
434 Q_PROPERTY(CornerShape bottomLeftCornerShape READ bottomLeftCornerShape WRITE
435 setBottomLeftCornerShape RESET resetBottomLeftCornerShape NOTIFY
436 bottomLeftCornerShapeChanged REVISION(6, 13))
437 Q_PROPERTY(CornerShape bottomRightCornerShape READ bottomRightCornerShape WRITE
438 setBottomRightCornerShape RESET resetBottomRightCornerShape NOTIFY
439 bottomRightCornerShapeChanged REVISION(6, 13))
441 QML_NAMED_ELEMENT(PathRectangle)
442 QML_ADDED_IN_VERSION(6, 8)
444 enum CornerShape { Rounded, Bevel, Squircle };
447 QQuickPathRectangle(QObject *parent =
nullptr) : QQuickCurve(parent) {}
450 void setWidth(qreal width);
452 qreal height()
const;
453 void setHeight(qreal height);
455 qreal strokeAdjustment()
const;
456 void setStrokeAdjustment(qreal newStrokeAdjustment);
458 qreal radius()
const;
459 void setRadius(qreal newRadius);
461 qreal topLeftRadius()
const {
return cornerRadius(Qt::TopLeftCorner); }
462 void setTopLeftRadius(qreal radius) { setCornerRadius(Qt::TopLeftCorner, radius); }
463 void resetTopLeftRadius() { resetCornerRadius(Qt::TopLeftCorner); }
465 qreal topRightRadius()
const {
return cornerRadius(Qt::TopRightCorner); }
466 void setTopRightRadius(qreal radius) { setCornerRadius(Qt::TopRightCorner, radius); }
467 void resetTopRightRadius() { resetCornerRadius(Qt::TopRightCorner); }
469 qreal bottomLeftRadius()
const {
return cornerRadius(Qt::BottomLeftCorner); }
470 void setBottomLeftRadius(qreal radius) { setCornerRadius(Qt::BottomLeftCorner, radius); }
471 void resetBottomLeftRadius() { resetCornerRadius(Qt::BottomLeftCorner); }
473 qreal bottomRightRadius()
const {
return cornerRadius(Qt::BottomRightCorner); }
474 void setBottomRightRadius(qreal radius) { setCornerRadius(Qt::BottomRightCorner, radius); }
475 void resetBottomRightRadius() { resetCornerRadius(Qt::BottomRightCorner); }
477 qreal cornerRadius(Qt::Corner corner)
const;
478 void setCornerRadius(Qt::Corner corner, qreal newCornerRadius);
479 void resetCornerRadius(Qt::Corner corner);
481 bool hasBevel()
const;
482 void setBevel(
bool bevel);
484 bool hasTopLeftBevel()
const {
return cornerBevel(Qt::TopLeftCorner); }
485 void setTopLeftBevel(
bool bevel) { setCornerBevel(Qt::TopLeftCorner, bevel); }
486 void resetTopLeftBevel() { resetCornerBevel(Qt::TopLeftCorner); }
488 bool hasTopRightBevel()
const {
return cornerBevel(Qt::TopRightCorner); }
489 void setTopRightBevel(
bool bevel) { setCornerBevel(Qt::TopRightCorner, bevel); }
490 void resetTopRightBevel() { resetCornerBevel(Qt::TopRightCorner); }
492 bool hasBottomLeftBevel()
const {
return cornerBevel(Qt::BottomLeftCorner); }
493 void setBottomLeftBevel(
bool bevel) { setCornerBevel(Qt::BottomLeftCorner, bevel); }
494 void resetBottomLeftBevel() { resetCornerBevel(Qt::BottomLeftCorner); }
496 bool hasBottomRightBevel()
const {
return cornerBevel(Qt::BottomRightCorner); }
497 void setBottomRightBevel(
bool bevel) { setCornerBevel(Qt::BottomRightCorner, bevel); }
498 void resetBottomRightBevel() { resetCornerBevel(Qt::BottomRightCorner); }
500 bool cornerBevel(Qt::Corner corner)
const;
501 void setCornerBevel(Qt::Corner corner,
bool newCornerBevel);
502 void resetCornerBevel(Qt::Corner corner);
504 CornerShape cornerShape()
const;
505 void setCornerShape(CornerShape shape);
507 CornerShape topLeftCornerShape()
const {
return cornerShape(Qt::TopLeftCorner); }
508 void setTopLeftCornerShape(CornerShape shape) { setCornerShape(Qt::TopLeftCorner, shape); }
509 void resetTopLeftCornerShape() { resetCornerShape(Qt::TopLeftCorner); }
511 CornerShape topRightCornerShape()
const {
return cornerShape(Qt::TopRightCorner); }
512 void setTopRightCornerShape(CornerShape shape) { setCornerShape(Qt::TopRightCorner, shape); }
513 void resetTopRightCornerShape() { resetCornerShape(Qt::TopRightCorner); }
515 CornerShape bottomLeftCornerShape()
const {
return cornerShape(Qt::BottomLeftCorner); }
516 void setBottomLeftCornerShape(CornerShape shape)
518 setCornerShape(Qt::BottomLeftCorner, shape);
520 void resetBottomLeftCornerShape() { resetCornerShape(Qt::BottomLeftCorner); }
522 CornerShape bottomRightCornerShape()
const {
return cornerShape(Qt::BottomRightCorner); }
523 void setBottomRightCornerShape(CornerShape shape)
525 setCornerShape(Qt::BottomRightCorner, shape);
527 void resetBottomRightCornerShape() { resetCornerShape(Qt::BottomRightCorner); }
529 CornerShape cornerShape(Qt::Corner corner)
const;
530 void setCornerShape(Qt::Corner corner, CornerShape newCornerShape);
531 void resetCornerShape(Qt::Corner corner);
533 void addToPath(QPainterPath &path,
const QQuickPathData &) override;
537 void heightChanged();
538 void strokeAdjustmentChanged();
539 void radiusChanged();
540 void topLeftRadiusChanged();
541 void topRightRadiusChanged();
542 void bottomLeftRadiusChanged();
543 void bottomRightRadiusChanged();
544 Q_REVISION(6, 10)
void bevelChanged();
545 Q_REVISION(6, 10)
void topLeftBevelChanged();
546 Q_REVISION(6, 10)
void topRightBevelChanged();
547 Q_REVISION(6, 10)
void bottomLeftBevelChanged();
548 Q_REVISION(6, 10)
void bottomRightBevelChanged();
549 Q_REVISION(6, 13)
void cornerShapeChanged();
550 Q_REVISION(6, 13)
void topLeftCornerShapeChanged();
551 Q_REVISION(6, 13)
void topRightCornerShapeChanged();
552 Q_REVISION(6, 13)
void bottomLeftCornerShapeChanged();
553 Q_REVISION(6, 13)
void bottomRightCornerShapeChanged();
556 void emitCornerRadiusChanged(Qt::Corner corner);
557 void emitCornerShapeChanged(Qt::Corner corner,
bool oldBevel);
561 qreal _strokeAdjustment = 0;
565 CornerShape shape = Rounded;
567 struct IndividualCornerData
569 IndividualCornerData() : shape(Rounded), isRadiusSet(0), isShapeSet(0) { }
572 unsigned isRadiusSet : 1;
573 unsigned isShapeSet : 1;
576 IndividualCornerData cornerData[4];
577 inline bool isRadiusSet(Qt::Corner corner) {
578 return cornerData[corner].isRadiusSet;
580 inline bool isShapeSet(Qt::Corner corner)
582 return cornerData[corner].isShapeSet;
585 QLazilyAllocated<ExtraData> _extra;
669class Q_QUICK_EXPORT
QQuickPath :
public QObject,
public QQmlParserStatus
673 Q_INTERFACES(QQmlParserStatus)
674 Q_PROPERTY(QQmlListProperty<QQuickPathElement> pathElements READ pathElements)
675 Q_PROPERTY(qreal startX READ startX WRITE setStartX NOTIFY startXChanged)
676 Q_PROPERTY(qreal startY READ startY WRITE setStartY NOTIFY startYChanged)
677 Q_PROPERTY(
bool closed READ isClosed NOTIFY changed)
678 Q_PROPERTY(
bool simplify READ simplify WRITE setSimplify NOTIFY simplifyChanged REVISION(6, 6) FINAL)
679 Q_PROPERTY(QSizeF scale READ scale WRITE setScale NOTIFY scaleChanged VIRTUAL REVISION(2, 14))
680 Q_PROPERTY(
bool asynchronous READ isAsynchronous WRITE setAsynchronous NOTIFY asynchronousChanged REVISION(6, 9))
681 Q_CLASSINFO(
"DefaultProperty",
"pathElements")
682 QML_NAMED_ELEMENT(Path)
683 QML_ADDED_IN_VERSION(2, 0)
685 QQuickPath(QObject *parent=
nullptr);
686 ~QQuickPath() override;
688 QQmlListProperty<QQuickPathElement> pathElements();
690 qreal startX()
const;
691 void setStartX(qreal x);
692 bool hasStartX()
const;
694 qreal startY()
const;
695 void setStartY(qreal y);
696 bool hasStartY()
const;
698 bool isClosed()
const;
700 QPainterPath path()
const;
701 void setPath(
const QPainterPath &path);
703 QStringList attributes()
const;
704 qreal attributeAt(
const QString &, qreal)
const;
705 Q_REVISION(2, 14) Q_INVOKABLE QPointF pointAtPercent(qreal t)
const;
706 QPointF sequentialPointAt(qreal p, qreal *angle =
nullptr)
const;
707 void invalidateSequentialHistory()
const;
709 QSizeF scale()
const;
710 void setScale(
const QSizeF &scale);
712 bool simplify()
const;
713 void setSimplify(
bool s);
715 bool isAsynchronous()
const;
716 void setAsynchronous(
bool a);
725 void startXChanged();
726 void startYChanged();
727 Q_REVISION(6, 6)
void simplifyChanged();
728 Q_REVISION(2, 14)
void scaleChanged();
729 Q_REVISION(6, 9)
void asynchronousChanged();
732 QQuickPath(QQuickPathPrivate &dd, QObject *parent =
nullptr);
733 void componentComplete() override;
734 void classBegin() override;
735 void disconnectPathElements();
736 void connectPathElements();
737 void gatherAttributes();
740 static QQuickPathElement *pathElements_at(QQmlListProperty<QQuickPathElement> *, qsizetype);
741 static void pathElements_append(QQmlListProperty<QQuickPathElement> *, QQuickPathElement *);
742 static qsizetype pathElements_count(QQmlListProperty<QQuickPathElement> *);
743 static void pathElements_clear(QQmlListProperty<QQuickPathElement> *);
744 static void pathElements_replace(
745 QQmlListProperty<QQuickPathElement> *, qsizetype, QQuickPathElement *);
746 static void pathElements_removeLast(QQmlListProperty<QQuickPathElement> *);
749 struct AttributePoint {
751 AttributePoint(
const AttributePoint &other)
752 : percent(other.percent), scale(other.scale), origpercent(other.origpercent), values(other.values) {}
753 AttributePoint &operator=(
const AttributePoint &other) {
754 percent = other.percent; scale = other.scale; origpercent = other.origpercent; values = other.values;
return *
this;
758 qreal origpercent = 0;
759 QHash<QString, qreal> values;
762 void doProcessPath();
763 void interpolate(
int idx,
const QString &name, qreal value);
764 void endpoint(
const QString &name);
765 void createPointCache()
const;
767 static void interpolate(QList<AttributePoint> &points,
int idx,
const QString &name, qreal value);
768 static void endpoint(QList<AttributePoint> &attributePoints,
const QString &name);
769 static QPointF forwardsPointAt(
const QPainterPath &path,
const qreal &pathLength,
const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle =
nullptr);
770 static QPointF backwardsPointAt(
const QPainterPath &path,
const qreal &pathLength,
const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle =
nullptr);
773 Q_DISABLE_COPY(QQuickPath)
774 Q_DECLARE_PRIVATE(QQuickPath)
775 friend class QQuickPathAnimationUpdater;
778 QPainterPath createPath(
const QPointF &startPoint,
const QPointF &endPoint,
const QStringList &attributes, qreal &pathLength, QList<AttributePoint> &attributePoints,
bool *closed =
nullptr);
779 QPainterPath createShapePath(
const QPointF &startPoint,
const QPointF &endPoint, qreal &pathLength,
bool *closed =
nullptr);
780 static QPointF sequentialPointAt(
const QPainterPath &path,
const qreal &pathLength,
const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle =
nullptr);