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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKRECTANGLESHAPE_P_H
6#define QQUICKRECTANGLESHAPE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickShapes/private/qquickshape_p.h>
20#include <QtQuickShapesDesignHelpers/qtquickshapesdesignhelpersexports.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickRectangleShapePrivate;
25
26class Q_QUICKSHAPESDESIGNHELPERS_EXPORT QQuickRectangleShape : public QQuickShape
27{
28 Q_OBJECT
29
30 Q_PROPERTY(bool drawTop READ drawTop WRITE setDrawTop NOTIFY drawTopChanged RESET resetDrawTop FINAL REVISION(6, 11))
31 Q_PROPERTY(bool drawRight READ drawRight WRITE setDrawRight NOTIFY drawRightChanged RESET resetDrawRight FINAL REVISION(6, 11))
32 Q_PROPERTY(bool drawBottom READ drawBottom WRITE setDrawBottom NOTIFY drawBottomChanged RESET resetDrawBottom FINAL REVISION(6, 11))
33 Q_PROPERTY(bool drawLeft READ drawLeft WRITE setDrawLeft NOTIFY drawLeftChanged RESET resetDrawLeft FINAL REVISION(6, 11))
34 Q_PROPERTY(int radius READ radius WRITE setRadius NOTIFY radiusChanged FINAL)
35 Q_PROPERTY(int topLeftRadius READ topLeftRadius WRITE setTopLeftRadius NOTIFY topLeftRadiusChanged RESET resetTopLeftRadius FINAL)
36 Q_PROPERTY(int topRightRadius READ topRightRadius WRITE setTopRightRadius NOTIFY topRightRadiusChanged RESET resetTopRightRadius FINAL)
37 Q_PROPERTY(int bottomLeftRadius READ bottomLeftRadius WRITE setBottomLeftRadius NOTIFY bottomLeftRadiusChanged RESET resetBottomLeftRadius FINAL)
38 Q_PROPERTY(int bottomRightRadius READ bottomRightRadius WRITE setBottomRightRadius NOTIFY bottomRightRadiusChanged RESET resetBottomRightRadius FINAL)
39 Q_PROPERTY(bool bevel READ hasBevel WRITE setBevel NOTIFY bevelChanged RESET resetBevel FINAL)
40 Q_PROPERTY(bool topLeftBevel READ hasTopLeftBevel WRITE setTopLeftBevel NOTIFY topLeftBevelChanged RESET resetTopLeftBevel FINAL)
41 Q_PROPERTY(bool topRightBevel READ hasTopRightBevel WRITE setTopRightBevel NOTIFY topRightBevelChanged RESET resetTopRightBevel FINAL)
42 Q_PROPERTY(bool bottomLeftBevel READ hasBottomLeftBevel WRITE setBottomLeftBevel NOTIFY bottomLeftBevelChanged RESET resetBottomLeftBevel FINAL)
43 Q_PROPERTY(bool bottomRightBevel READ hasBottomRightBevel WRITE setBottomRightBevel NOTIFY bottomRightBevelChanged RESET resetBottomRightBevel FINAL)
44 Q_PROPERTY(QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged FINAL)
45 Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged FINAL)
46 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged FINAL)
47 Q_PROPERTY(QQuickShapePath::JoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged FINAL)
48 Q_PROPERTY(QQuickShapePath::CapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged FINAL)
49 Q_PROPERTY(QQuickShapePath::StrokeStyle strokeStyle READ strokeStyle WRITE setStrokeStyle NOTIFY strokeStyleChanged FINAL)
50 Q_PROPERTY(qreal dashOffset READ dashOffset WRITE setDashOffset NOTIFY dashOffsetChanged FINAL)
51 Q_PROPERTY(QList<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged FINAL)
52 Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient NOTIFY fillGradientChanged RESET resetFillGradient FINAL)
53 Q_PROPERTY(BorderMode borderMode READ borderMode WRITE setBorderMode NOTIFY borderModeChanged RESET resetBorderMode FINAL)
54 Q_PROPERTY(QQuickItem *fillItem READ fillItem WRITE setFillItem NOTIFY fillItemChanged FINAL REVISION(6, 12))
55
56 QML_NAMED_ELEMENT(RectangleShape)
57 QML_ADDED_IN_VERSION(6, 10)
58
59public:
60 QQuickRectangleShape(QQuickItem *parent = nullptr);
61 ~QQuickRectangleShape();
62
63 bool drawTop() const;
64 void setDrawTop(bool drawTop);
65 void resetDrawTop();
66
67 bool drawRight() const;
68 void setDrawRight(bool drawRight);
69 void resetDrawRight();
70
71 bool drawBottom() const;
72 void setDrawBottom(bool drawBottom);
73 void resetDrawBottom();
74
75 bool drawLeft() const;
76 void setDrawLeft(bool drawLeft);
77 void resetDrawLeft();
78
79 int radius() const;
80 void setRadius(int radius);
81 void resetRadius();
82
83 int topLeftRadius() const;
84 void setTopLeftRadius(int topLeftRadius);
85 void resetTopLeftRadius();
86
87 int topRightRadius() const;
88 void setTopRightRadius(int topRightRadius);
89 void resetTopRightRadius();
90
91 int bottomLeftRadius() const;
92 void setBottomLeftRadius(int bottomLeftRadius);
93 void resetBottomLeftRadius();
94
95 int bottomRightRadius() const;
96 void setBottomRightRadius(int bottomRightRadius);
97 void resetBottomRightRadius();
98
99 bool hasBevel() const;
100 void setBevel(bool bevel);
101 void resetBevel();
102
103 bool hasTopLeftBevel() const;
104 void setTopLeftBevel(bool topLeftBevel);
105 void resetTopLeftBevel();
106
107 bool hasTopRightBevel() const;
108 void setTopRightBevel(bool topRightBevel);
109 void resetTopRightBevel();
110
111 bool hasBottomLeftBevel() const;
112 void setBottomLeftBevel(bool bottomLeftBevel);
113 void resetBottomLeftBevel();
114
115 bool hasBottomRightBevel() const;
116 void setBottomRightBevel(bool bottomRightBevel);
117 void resetBottomRightBevel();
118
119 QColor strokeColor() const;
120 void setStrokeColor(const QColor &color);
121
122 qreal strokeWidth() const;
123 void setStrokeWidth(qreal width);
124
125 QColor fillColor() const;
126 void setFillColor(const QColor &color);
127
128 QQuickShapePath::FillRule fillRule() const;
129 void setFillRule(QQuickShapePath::FillRule fillRule);
130
131 QQuickShapePath::JoinStyle joinStyle() const;
132 void setJoinStyle(QQuickShapePath::JoinStyle style);
133
134 int miterLimit() const;
135 void setMiterLimit(int limit);
136
137 QQuickShapePath::CapStyle capStyle() const;
138 void setCapStyle(QQuickShapePath::CapStyle style);
139
140 QQuickShapePath::StrokeStyle strokeStyle() const;
141 void setStrokeStyle(QQuickShapePath::StrokeStyle style);
142
143 qreal dashOffset() const;
144 void setDashOffset(qreal offset);
145
146 QList<qreal> dashPattern() const;
147 void setDashPattern(const QList<qreal> &array);
148
149 QQuickShapeGradient *fillGradient() const;
150 void setFillGradient(QQuickShapeGradient *fillGradient);
151 void resetFillGradient();
152
153 enum class BorderMode {
154 Inside,
155 Middle,
156 Outside
157 };
158 Q_ENUM(BorderMode)
159 BorderMode borderMode() const;
160 void setBorderMode(BorderMode borderMode);
161 void resetBorderMode();
162
163 QQuickItem *fillItem() const;
164 void setFillItem(QQuickItem *newFillItem);
165
166Q_SIGNALS:
167 Q_REVISION(6, 11) void drawTopChanged();
168 Q_REVISION(6, 11) void drawRightChanged();
169 Q_REVISION(6, 11) void drawBottomChanged();
170 Q_REVISION(6, 11) void drawLeftChanged();
171 Q_REVISION(6, 11) void fillGradientChanged();
172 void radiusChanged();
173 void topLeftRadiusChanged();
174 void topRightRadiusChanged();
175 void bottomLeftRadiusChanged();
176 void bottomRightRadiusChanged();
177 void bevelChanged();
178 void topLeftBevelChanged();
179 void topRightBevelChanged();
180 void bottomLeftBevelChanged();
181 void bottomRightBevelChanged();
182 void shapePathChanged();
183 void strokeColorChanged();
184 void strokeWidthChanged();
185 void fillColorChanged();
186 void fillRuleChanged();
187 void joinStyleChanged();
188 void miterLimitChanged();
189 void capStyleChanged();
190 void strokeStyleChanged();
191 void dashOffsetChanged();
192 void dashPatternChanged();
193 void borderModeChanged();
194 Q_REVISION(6, 12) void fillItemChanged();
195
196protected:
197 void componentComplete() override;
198 void itemChange(ItemChange change, const ItemChangeData &value) override;
199
200private:
201 void updatePolish() override;
202
203 Q_DISABLE_COPY(QQuickRectangleShape)
204 Q_DECLARE_PRIVATE(QQuickRectangleShape)
205};
206
207QT_END_NAMESPACE
208
209#endif // QQUICKRECTANGLESHAPE_P_H
\inmodule QtQuickShapes
Combined button and popup list for selecting options.
T * createElement(QQuickShapePath *shapePath, const char *objectName)