| 1 | // Copyright (C) 2025 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICKRECTANGLESHAPE_P_H |
| 5 | #define QQUICKRECTANGLESHAPE_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQuickShapes/private/qquickshape_p.h> |
| 19 | #include <QtQuickShapesDesignHelpers/qtquickshapesdesignhelpersexports.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class QQuickRectangleShapePrivate; |
| 24 | |
| 25 | class Q_QUICKSHAPESDESIGNHELPERS_EXPORT QQuickRectangleShape : public QQuickShape |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | |
| 29 | Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged) |
| 30 | Q_PROPERTY(int topLeftRadius READ topLeftRadius WRITE setTopLeftRadius NOTIFY topLeftRadiusChanged RESET resetTopLeftRadius FINAL) |
| 31 | Q_PROPERTY(int topRightRadius READ topRightRadius WRITE setTopRightRadius NOTIFY topRightRadiusChanged RESET resetTopRightRadius FINAL) |
| 32 | Q_PROPERTY(int bottomLeftRadius READ bottomLeftRadius WRITE setBottomLeftRadius NOTIFY bottomLeftRadiusChanged RESET resetBottomLeftRadius FINAL) |
| 33 | Q_PROPERTY(int bottomRightRadius READ bottomRightRadius WRITE setBottomRightRadius NOTIFY bottomRightRadiusChanged RESET resetBottomRightRadius FINAL) |
| 34 | Q_PROPERTY(bool bevel READ hasBevel WRITE setBevel NOTIFY bevelChanged FINAL) |
| 35 | Q_PROPERTY(bool topLeftBevel READ hasTopLeftBevel WRITE setTopLeftBevel NOTIFY topLeftBevelChanged RESET resetTopLeftBevel FINAL) |
| 36 | Q_PROPERTY(bool topRightBevel READ hasTopRightBevel WRITE setTopRightBevel NOTIFY topRightBevelChanged RESET resetTopRightBevel FINAL) |
| 37 | Q_PROPERTY(bool bottomLeftBevel READ hasBottomLeftBevel WRITE setBottomLeftBevel NOTIFY bottomLeftBevelChanged RESET resetBottomLeftBevel FINAL) |
| 38 | Q_PROPERTY(bool bottomRightBevel READ hasBottomRightBevel WRITE setBottomRightBevel NOTIFY bottomRightBevelChanged RESET resetBottomRightBevel FINAL) |
| 39 | Q_PROPERTY(QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged FINAL) |
| 40 | Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged FINAL) |
| 41 | Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged FINAL) |
| 42 | Q_PROPERTY(QQuickShapePath::JoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged FINAL) |
| 43 | Q_PROPERTY(QQuickShapePath::CapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged FINAL) |
| 44 | Q_PROPERTY(QQuickShapePath::StrokeStyle strokeStyle READ strokeStyle WRITE setStrokeStyle NOTIFY strokeStyleChanged FINAL) |
| 45 | Q_PROPERTY(qreal dashOffset READ dashOffset WRITE setDashOffset NOTIFY dashOffsetChanged FINAL) |
| 46 | Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged FINAL) |
| 47 | Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient FINAL) |
| 48 | Q_PROPERTY(BorderMode borderMode READ borderMode WRITE setBorderMode RESET resetBorderMode FINAL) |
| 49 | |
| 50 | QML_NAMED_ELEMENT(RectangleShape) |
| 51 | QML_ADDED_IN_VERSION(6, 10) |
| 52 | |
| 53 | public: |
| 54 | QQuickRectangleShape(QQuickItem *parent = nullptr); |
| 55 | ~QQuickRectangleShape(); |
| 56 | |
| 57 | int radius() const; |
| 58 | void setRadius(int radius); |
| 59 | |
| 60 | int topLeftRadius() const; |
| 61 | void setTopLeftRadius(int topLeftRadius); |
| 62 | void resetTopLeftRadius(); |
| 63 | |
| 64 | int topRightRadius() const; |
| 65 | void setTopRightRadius(int topRightRadius); |
| 66 | void resetTopRightRadius(); |
| 67 | |
| 68 | int bottomLeftRadius() const; |
| 69 | void setBottomLeftRadius(int bottomLeftRadius); |
| 70 | void resetBottomLeftRadius(); |
| 71 | |
| 72 | int bottomRightRadius() const; |
| 73 | void setBottomRightRadius(int bottomRightRadius); |
| 74 | void resetBottomRightRadius(); |
| 75 | |
| 76 | bool hasBevel() const; |
| 77 | void setBevel(bool bevel); |
| 78 | |
| 79 | bool hasTopLeftBevel() const; |
| 80 | void setTopLeftBevel(bool topLeftBevel); |
| 81 | void resetTopLeftBevel(); |
| 82 | |
| 83 | bool hasTopRightBevel() const; |
| 84 | void setTopRightBevel(bool topRightBevel); |
| 85 | void resetTopRightBevel(); |
| 86 | |
| 87 | bool hasBottomLeftBevel() const; |
| 88 | void setBottomLeftBevel(bool bottomLeftBevel); |
| 89 | void resetBottomLeftBevel(); |
| 90 | |
| 91 | bool hasBottomRightBevel() const; |
| 92 | void setBottomRightBevel(bool bottomRightBevel); |
| 93 | void resetBottomRightBevel(); |
| 94 | |
| 95 | QColor strokeColor() const; |
| 96 | void setStrokeColor(const QColor &color); |
| 97 | |
| 98 | qreal strokeWidth() const; |
| 99 | void setStrokeWidth(qreal width); |
| 100 | |
| 101 | QColor fillColor() const; |
| 102 | void setFillColor(const QColor &color); |
| 103 | |
| 104 | QQuickShapePath::FillRule fillRule() const; |
| 105 | void setFillRule(QQuickShapePath::FillRule fillRule); |
| 106 | |
| 107 | QQuickShapePath::JoinStyle joinStyle() const; |
| 108 | void setJoinStyle(QQuickShapePath::JoinStyle style); |
| 109 | |
| 110 | QQuickShapePath::CapStyle capStyle() const; |
| 111 | void setCapStyle(QQuickShapePath::CapStyle style); |
| 112 | |
| 113 | QQuickShapePath::StrokeStyle strokeStyle() const; |
| 114 | void setStrokeStyle(QQuickShapePath::StrokeStyle style); |
| 115 | |
| 116 | qreal dashOffset() const; |
| 117 | void setDashOffset(qreal offset); |
| 118 | |
| 119 | QVector<qreal> dashPattern() const; |
| 120 | void setDashPattern(const QVector<qreal> &array); |
| 121 | |
| 122 | QQuickShapeGradient *fillGradient() const; |
| 123 | void setFillGradient(QQuickShapeGradient *fillGradient); |
| 124 | void resetFillGradient(); |
| 125 | |
| 126 | enum BorderMode { |
| 127 | Inside, |
| 128 | Middle, |
| 129 | Outside |
| 130 | }; |
| 131 | Q_ENUM(BorderMode) |
| 132 | BorderMode borderMode() const; |
| 133 | void setBorderMode(BorderMode borderMode); |
| 134 | void resetBorderMode(); |
| 135 | |
| 136 | Q_SIGNALS: |
| 137 | void radiusChanged(); |
| 138 | void topLeftRadiusChanged(); |
| 139 | void topRightRadiusChanged(); |
| 140 | void bottomLeftRadiusChanged(); |
| 141 | void bottomRightRadiusChanged(); |
| 142 | void bevelChanged(); |
| 143 | void topLeftBevelChanged(); |
| 144 | void topRightBevelChanged(); |
| 145 | void bottomLeftBevelChanged(); |
| 146 | void bottomRightBevelChanged(); |
| 147 | void shapePathChanged(); |
| 148 | void strokeColorChanged(); |
| 149 | void strokeWidthChanged(); |
| 150 | void fillColorChanged(); |
| 151 | void fillRuleChanged(); |
| 152 | void joinStyleChanged(); |
| 153 | void capStyleChanged(); |
| 154 | void strokeStyleChanged(); |
| 155 | void dashOffsetChanged(); |
| 156 | void dashPatternChanged(); |
| 157 | void gradientChanged(); |
| 158 | void borderModeChanged(); |
| 159 | |
| 160 | protected: |
| 161 | void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; |
| 162 | |
| 163 | private: |
| 164 | Q_DISABLE_COPY(QQuickRectangleShape) |
| 165 | Q_DECLARE_PRIVATE(QQuickRectangleShape) |
| 166 | }; |
| 167 | |
| 168 | QT_END_NAMESPACE |
| 169 | |
| 170 | #endif // QQUICKRECTANGLESHAPE_P_H |
| 171 |
