Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickrectangleshape_p.h
Go to the documentation of this file.
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
21QT_BEGIN_NAMESPACE
22
23class QQuickRectangleShapePrivate;
24
25class Q_QUICKSHAPESDESIGNHELPERS_EXPORT QQuickRectangleShape : public QQuickShape
26{
27 Q_OBJECT
28
29 Q_PROPERTY(bool drawTop READ drawTop WRITE setDrawTop NOTIFY drawTopChanged RESET resetDrawTop FINAL REVISION(6, 11))
30 Q_PROPERTY(bool drawRight READ drawRight WRITE setDrawRight NOTIFY drawRightChanged RESET resetDrawRight FINAL REVISION(6, 11))
31 Q_PROPERTY(bool drawBottom READ drawBottom WRITE setDrawBottom NOTIFY drawBottomChanged RESET resetDrawBottom FINAL REVISION(6, 11))
32 Q_PROPERTY(bool drawLeft READ drawLeft WRITE setDrawLeft NOTIFY drawLeftChanged RESET resetDrawLeft FINAL REVISION(6, 11))
33 Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
34 Q_PROPERTY(int topLeftRadius READ topLeftRadius WRITE setTopLeftRadius NOTIFY topLeftRadiusChanged RESET resetTopLeftRadius FINAL)
35 Q_PROPERTY(int topRightRadius READ topRightRadius WRITE setTopRightRadius NOTIFY topRightRadiusChanged RESET resetTopRightRadius FINAL)
36 Q_PROPERTY(int bottomLeftRadius READ bottomLeftRadius WRITE setBottomLeftRadius NOTIFY bottomLeftRadiusChanged RESET resetBottomLeftRadius FINAL)
37 Q_PROPERTY(int bottomRightRadius READ bottomRightRadius WRITE setBottomRightRadius NOTIFY bottomRightRadiusChanged RESET resetBottomRightRadius FINAL)
38 Q_PROPERTY(bool bevel READ hasBevel WRITE setBevel NOTIFY bevelChanged RESET resetBevel FINAL)
39 Q_PROPERTY(bool topLeftBevel READ hasTopLeftBevel WRITE setTopLeftBevel NOTIFY topLeftBevelChanged RESET resetTopLeftBevel FINAL)
40 Q_PROPERTY(bool topRightBevel READ hasTopRightBevel WRITE setTopRightBevel NOTIFY topRightBevelChanged RESET resetTopRightBevel FINAL)
41 Q_PROPERTY(bool bottomLeftBevel READ hasBottomLeftBevel WRITE setBottomLeftBevel NOTIFY bottomLeftBevelChanged RESET resetBottomLeftBevel FINAL)
42 Q_PROPERTY(bool bottomRightBevel READ hasBottomRightBevel WRITE setBottomRightBevel NOTIFY bottomRightBevelChanged RESET resetBottomRightBevel FINAL)
43 Q_PROPERTY(QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged FINAL)
44 Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged FINAL)
45 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged FINAL)
46 Q_PROPERTY(QQuickShapePath::JoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged FINAL)
47 Q_PROPERTY(QQuickShapePath::CapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged FINAL)
48 Q_PROPERTY(QQuickShapePath::StrokeStyle strokeStyle READ strokeStyle WRITE setStrokeStyle NOTIFY strokeStyleChanged FINAL)
49 Q_PROPERTY(qreal dashOffset READ dashOffset WRITE setDashOffset NOTIFY dashOffsetChanged FINAL)
50 Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged FINAL)
51 Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient FINAL)
52 Q_PROPERTY(BorderMode borderMode READ borderMode WRITE setBorderMode RESET resetBorderMode FINAL)
53
54 QML_NAMED_ELEMENT(RectangleShape)
55 QML_ADDED_IN_VERSION(6, 10)
56
57public:
58 QQuickRectangleShape(QQuickItem *parent = nullptr);
59 ~QQuickRectangleShape();
60
61 bool drawTop() const;
62 void setDrawTop(bool drawTop);
63 void resetDrawTop();
64
65 bool drawRight() const;
66 void setDrawRight(bool drawRight);
67 void resetDrawRight();
68
69 bool drawBottom() const;
70 void setDrawBottom(bool drawBottom);
71 void resetDrawBottom();
72
73 bool drawLeft() const;
74 void setDrawLeft(bool drawLeft);
75 void resetDrawLeft();
76
77 int radius() const;
78 void setRadius(int radius);
79 void resetRadius();
80
81 int topLeftRadius() const;
82 void setTopLeftRadius(int topLeftRadius);
83 void resetTopLeftRadius();
84
85 int topRightRadius() const;
86 void setTopRightRadius(int topRightRadius);
87 void resetTopRightRadius();
88
89 int bottomLeftRadius() const;
90 void setBottomLeftRadius(int bottomLeftRadius);
91 void resetBottomLeftRadius();
92
93 int bottomRightRadius() const;
94 void setBottomRightRadius(int bottomRightRadius);
95 void resetBottomRightRadius();
96
97 bool hasBevel() const;
98 void setBevel(bool bevel);
99 void resetBevel();
100
101 bool hasTopLeftBevel() const;
102 void setTopLeftBevel(bool topLeftBevel);
103 void resetTopLeftBevel();
104
105 bool hasTopRightBevel() const;
106 void setTopRightBevel(bool topRightBevel);
107 void resetTopRightBevel();
108
109 bool hasBottomLeftBevel() const;
110 void setBottomLeftBevel(bool bottomLeftBevel);
111 void resetBottomLeftBevel();
112
113 bool hasBottomRightBevel() const;
114 void setBottomRightBevel(bool bottomRightBevel);
115 void resetBottomRightBevel();
116
117 QColor strokeColor() const;
118 void setStrokeColor(const QColor &color);
119
120 qreal strokeWidth() const;
121 void setStrokeWidth(qreal width);
122
123 QColor fillColor() const;
124 void setFillColor(const QColor &color);
125
126 QQuickShapePath::FillRule fillRule() const;
127 void setFillRule(QQuickShapePath::FillRule fillRule);
128
129 QQuickShapePath::JoinStyle joinStyle() const;
130 void setJoinStyle(QQuickShapePath::JoinStyle style);
131
132 int miterLimit() const;
133 void setMiterLimit(int limit);
134
135 QQuickShapePath::CapStyle capStyle() const;
136 void setCapStyle(QQuickShapePath::CapStyle style);
137
138 QQuickShapePath::StrokeStyle strokeStyle() const;
139 void setStrokeStyle(QQuickShapePath::StrokeStyle style);
140
141 qreal dashOffset() const;
142 void setDashOffset(qreal offset);
143
144 QVector<qreal> dashPattern() const;
145 void setDashPattern(const QVector<qreal> &array);
146
147 QQuickShapeGradient *fillGradient() const;
148 void setFillGradient(QQuickShapeGradient *fillGradient);
149 void resetFillGradient();
150
151 enum class BorderMode {
152 Inside,
153 Middle,
154 Outside
155 };
156 Q_ENUM(BorderMode)
157 BorderMode borderMode() const;
158 void setBorderMode(BorderMode borderMode);
159 void resetBorderMode();
160
161Q_SIGNALS:
162 Q_REVISION(6, 11) void drawTopChanged();
163 Q_REVISION(6, 11) void drawRightChanged();
164 Q_REVISION(6, 11) void drawBottomChanged();
165 Q_REVISION(6, 11) void drawLeftChanged();
166 void radiusChanged();
167 void topLeftRadiusChanged();
168 void topRightRadiusChanged();
169 void bottomLeftRadiusChanged();
170 void bottomRightRadiusChanged();
171 void bevelChanged();
172 void topLeftBevelChanged();
173 void topRightBevelChanged();
174 void bottomLeftBevelChanged();
175 void bottomRightBevelChanged();
176 void shapePathChanged();
177 void strokeColorChanged();
178 void strokeWidthChanged();
179 void fillColorChanged();
180 void fillRuleChanged();
181 void joinStyleChanged();
182 void miterLimitChanged();
183 void capStyleChanged();
184 void strokeStyleChanged();
185 void dashOffsetChanged();
186 void dashPatternChanged();
187 void borderModeChanged();
188
189protected:
190 void componentComplete() override;
191
192private:
193 void updatePolish() override;
194
195 Q_DISABLE_COPY(QQuickRectangleShape)
196 Q_DECLARE_PRIVATE(QQuickRectangleShape)
197};
198
199QT_END_NAMESPACE
200
201#endif // QQUICKRECTANGLESHAPE_P_H
T * createElement(QQuickShapePath *shapePath, const char *objectName)