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.cpp
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
7
9
10/*!
11 \class QQuickRectangleShape
12 \inmodule QtQuickShapes
13 \internal
14*/
15
16Q_STATIC_LOGGING_CATEGORY(lcCalculateIndependentRadii, "qt.quick.shapes.designhelpers.rectangleshape.calculateindependentradii")
17Q_STATIC_LOGGING_CATEGORY(lcUpdatePolish, "qt.quick.shapes.designhelpers.rectangleshape.updatepolish")
18Q_STATIC_LOGGING_CATEGORY(lcMaybeUpdateElements, "qt.quick.shapes.designhelpers.rectangleshape.maybeupdateelements")
19
20void QQuickRectangleShapePrivate::setTopLeftRadius(int topLeftRadius,
21 QQml::PropertyUtils::State propertyState)
22{
23 Q_Q(QQuickRectangleShape);
24 const int oldEffectiveTopLeftRadius = q->topLeftRadius();
25 explicitTopLeftRadius = isExplicitlySet(propertyState);
26 this->topLeftRadius = topLeftRadius;
27
28 if (q->topLeftRadius() == oldEffectiveTopLeftRadius)
29 return;
30
31 q->polish();
32 emit q->topLeftRadiusChanged();
33}
34
35void QQuickRectangleShapePrivate::setTopRightRadius(int topRightRadius,
36 QQml::PropertyUtils::State propertyState)
37{
38 Q_Q(QQuickRectangleShape);
39 const int oldEffectiveTopRightRadius = q->topRightRadius();
40 explicitTopRightRadius = isExplicitlySet(propertyState);
41 this->topRightRadius = topRightRadius;
42
43 if (q->topRightRadius() == oldEffectiveTopRightRadius)
44 return;
45
46 q->polish();
47 emit q->topRightRadiusChanged();
48}
49
50void QQuickRectangleShapePrivate::setBottomLeftRadius(int bottomLeftRadius,
51 QQml::PropertyUtils::State propertyState)
52{
53 Q_Q(QQuickRectangleShape);
54 const int oldEffectiveBottomLeftRadius = q->bottomLeftRadius();
55 explicitBottomLeftRadius = isExplicitlySet(propertyState);
56 this->bottomLeftRadius = bottomLeftRadius;
57
58 if (q->bottomLeftRadius() == oldEffectiveBottomLeftRadius)
59 return;
60
61 q->polish();
62 emit q->bottomLeftRadiusChanged();
63}
64
65void QQuickRectangleShapePrivate::setBottomRightRadius(int bottomRightRadius,
66 QQml::PropertyUtils::State propertyState)
67{
68 Q_Q(QQuickRectangleShape);
69 const int oldEffectiveBottomRightRadius = q->bottomRightRadius();
70 explicitBottomRightRadius = isExplicitlySet(propertyState);
71 this->bottomRightRadius = bottomRightRadius;
72
73 if (q->bottomRightRadius() == oldEffectiveBottomRightRadius)
74 return;
75
76 q->polish();
77 emit q->bottomRightRadiusChanged();
78}
79
80void QQuickRectangleShapePrivate::setTopLeftBevel(bool topLeftBevel,
81 QQml::PropertyUtils::State propertyState)
82{
83 Q_Q(QQuickRectangleShape);
84 const bool oldTopLeftBevel = q->hasTopLeftBevel();
85 explicitTopLeftBevel = isExplicitlySet(propertyState);
86 this->topLeftBevel = topLeftBevel;
87
88 if (q->hasTopLeftBevel() == oldTopLeftBevel)
89 return;
90
91 q->polish();
92 emit q->topLeftBevelChanged();
93}
94
95void QQuickRectangleShapePrivate::setTopRightBevel(bool topRightBevel,
96 QQml::PropertyUtils::State propertyState)
97{
98 Q_Q(QQuickRectangleShape);
99 const bool oldTopRightBevel = q->hasTopRightBevel();
100 explicitTopRightBevel = isExplicitlySet(propertyState);
101 this->topRightBevel = topRightBevel;
102
103 if (q->hasTopRightBevel() == oldTopRightBevel)
104 return;
105
106 q->polish();
107 emit q->topRightBevelChanged();
108}
109
110void QQuickRectangleShapePrivate::setBottomLeftBevel(bool bottomLeftBevel,
111 QQml::PropertyUtils::State propertyState)
112{
113 Q_Q(QQuickRectangleShape);
114 const bool oldBottomLeftBevel = q->hasBottomLeftBevel();
115 explicitBottomLeftBevel = isExplicitlySet(propertyState);
116 this->bottomLeftBevel = bottomLeftBevel;
117
118 if (q->hasBottomLeftBevel() == oldBottomLeftBevel)
119 return;
120
121 q->polish();
122 emit q->bottomLeftBevelChanged();
123}
124
125void QQuickRectangleShapePrivate::setBottomRightBevel(bool bottomRightBevel,
126 QQml::PropertyUtils::State propertyState)
127{
128 Q_Q(QQuickRectangleShape);
129 const bool oldBottomRightBevel = q->hasBottomRightBevel();
130 explicitBottomRightBevel = isExplicitlySet(propertyState);
131 this->bottomRightBevel = bottomRightBevel;
132
133 if (q->hasBottomRightBevel() == oldBottomRightBevel)
134 return;
135
136 q->polish();
137 emit q->bottomRightBevelChanged();
138}
139
140template <typename T>
141T *createElement(QQuickShapePath *shapePath, const char *objectName)
142{
143 auto *element = new T(shapePath);
144 element->setObjectName(objectName);
145 return element;
146}
147
148/*!
149 \internal
150
151 Constructs and append the individual path elements to the ShapePath.
152*/
153void QQuickRectangleShapePrivate::maybeUpdateElements()
154{
155 if (!componentComplete)
156 return;
157
158 auto *shapePathPrivate = QQuickShapePathPrivate::get(shapePath);
159
160 // We need to delete the elements since we create them ourselves.
161 qCDebug(lcMaybeUpdateElements).nospace() << "maybeUpdateElements called on "
162 // Avoid printing the QQuickItem as it results in assertion failure in QQuickItemLayer::componentComplete.
163 << static_cast<void *>(q_func()) << "; deleting and clearing path elements";
164 shapePathPrivate->clearPathElements(QQuickPathPrivate::DeleteElementPolicy::Delete);
165
166 static const QQuickPathPrivate::ProcessPathPolicy DontProcessPath
167 = QQuickPathPrivate::ProcessPathPolicy::DontProcess;
168
169 // We avoid rendering issues (QDS-14861) by rotating the start position
170 // clockwise until the first visible edge after a hidden edge was found.
171 // Set the start position (startIndex) to that edge and continue the construction of
172 // the border item from there.
173 const std::array visibleEdges = {drawTop, drawRight, drawBottom, drawLeft };
174 int startIndex = 0;
175 for (int currentEdge = static_cast<int>(Edge::Top); currentEdge < static_cast<int>(Edge::NEdges); ++currentEdge) {
176 const int previousEdge = (currentEdge + 3) % 4;
177 if (!visibleEdges[previousEdge] && visibleEdges[currentEdge]) {
178 startIndex = currentEdge;
179 break;
180 }
181 }
182
183 firstVisibleEdge = static_cast<Edge>(startIndex);
184 qCDebug(lcMaybeUpdateElements) << "firstVisibleEdge:" << startIndex; // (Can't print the enum itself)
185
186 for (int i = 0; i < 4; i++) {
187 const int currentEdge = (startIndex + i) % 4;
188 const int nextEdge = (startIndex + i + 1) % 4;
189
190 switch (static_cast<Edge>(currentEdge)) {
191 case Edge::Top:
192 if (visibleEdges[currentEdge]) {
193 topPathLine = createElement<QQuickPathLine>(shapePath, "topPathLine");
194 shapePathPrivate->appendPathElement(topPathLine, DontProcessPath);
195 topPathMove = nullptr;
196 } else {
197 topPathLine = nullptr;
198 topPathMove = createElement<QQuickPathMove>(shapePath, "topPathMove");
199 shapePathPrivate->appendPathElement(topPathMove, DontProcessPath);
200 }
201
202 // Top right corner
203 if (visibleEdges[currentEdge] && visibleEdges[nextEdge]) {
204 topRightPathArc = createElement<QQuickPathArc>(shapePath, "topRightPathArc");
205 shapePathPrivate->appendPathElement(topRightPathArc, DontProcessPath);
206 } else {
207 topRightPathArc = nullptr;
208 }
209 break;
210 case Edge::Right:
211 if (visibleEdges[currentEdge]) {
212 rightPathLine = createElement<QQuickPathLine>(shapePath, "rightPathLine");
213 shapePathPrivate->appendPathElement(rightPathLine, DontProcessPath);
214 rightPathMove = nullptr;
215 } else {
216 rightPathLine = nullptr;
217 rightPathMove = createElement<QQuickPathMove>(shapePath, "rightPathMove");
218 shapePathPrivate->appendPathElement(rightPathMove, DontProcessPath);
219 }
220
221 // Bottom right corner
222 if (visibleEdges[currentEdge] && visibleEdges[nextEdge]) {
223 bottomRightPathArc = createElement<QQuickPathArc>(shapePath, "bottomRightPathArc");
224 shapePathPrivate->appendPathElement(bottomRightPathArc, DontProcessPath);
225 } else {
226 bottomRightPathArc = nullptr;
227 }
228 break;
229 case Edge::Bottom:
230 if (visibleEdges[currentEdge]) {
231 bottomPathLine = createElement<QQuickPathLine>(shapePath, "bottomPathLine");
232 shapePathPrivate->appendPathElement(bottomPathLine, DontProcessPath);
233 bottomPathMove = nullptr;
234 } else {
235 bottomPathLine = nullptr;
236 bottomPathMove = createElement<QQuickPathMove>(shapePath, "bottomPathMove");
237 shapePathPrivate->appendPathElement(bottomPathMove, DontProcessPath);
238 }
239
240 // Bottom left corner
241 if (visibleEdges[currentEdge] && visibleEdges[nextEdge]) {
242 bottomLeftPathArc = createElement<QQuickPathArc>(shapePath, "bottomLeftPathArc");
243 shapePathPrivate->appendPathElement(bottomLeftPathArc, DontProcessPath);
244 } else {
245 bottomLeftPathArc = nullptr;
246 }
247 break;
248 case Edge::Left:
249 if (visibleEdges[currentEdge]) {
250 leftPathLine = createElement<QQuickPathLine>(shapePath, "leftPathLine");
251 shapePathPrivate->appendPathElement(leftPathLine, DontProcessPath);
252 } else {
253 leftPathLine = nullptr;
254 // There isn't a leftPathMove because it will only be applicable for the case where
255 // there is only a top and bottom edge (the only configuration where a
256 // left-path-move could be needed), and if that is the case, it must start with the
257 // top edge, and must end at the left edge, so there is never need to move the path
258 // at the last (left in this case) edge.
259 }
260
261 // Top left corner
262 if (visibleEdges[currentEdge] && visibleEdges[nextEdge]) {
263 topLeftPathArc = createElement<QQuickPathArc>(shapePath, "topLeftPathArc");
264 shapePathPrivate->appendPathElement(topLeftPathArc, DontProcessPath);
265 } else {
266 topLeftPathArc = nullptr;
267 }
268 break;
269 case Edge::NEdges:
270 Q_UNREACHABLE();
271 }
272 }
273
274 qCDebug(lcMaybeUpdateElements) << "about to process path";
275 shapePath->processPath();
276 qCDebug(lcMaybeUpdateElements) << "about to call _q_shapePathChanged (i.e. polish and update implicit size)";
277 _q_shapePathChanged();
278}
279
280void QQuickRectangleShapePrivate::calculateIndependentRadii()
281{
282 Q_Q(const QQuickRectangleShape);
283 const qreal rectWidth = width.valueBypassingBindings();
284 const qreal rectHeight = height.valueBypassingBindings();
285 const int minDimension = qMin(rectWidth, rectHeight);
286 const int maxRadius = minDimension / 2;
287 const int topLeftRadius = q->topLeftRadius();
288 const int topRightRadius = q->topRightRadius();
289 const int bottomRightRadius = q->bottomRightRadius();
290 const int bottomLeftRadius = q->bottomLeftRadius();
291 const bool mixed = !(radius == topLeftRadius
292 && radius == topRightRadius
293 && radius == bottomLeftRadius
294 && radius == bottomRightRadius);
295
296 // Uniform radii
297 if (!mixed) {
298 effectiveTopLeftRadius = qMin(topLeftRadius, maxRadius);
299 effectiveTopRightRadius = qMin(topRightRadius, maxRadius);
300 effectiveBottomRightRadius = qMin(bottomRightRadius, maxRadius);
301 effectiveBottomLeftRadius = qMin(bottomLeftRadius, maxRadius);
302 qCDebug(lcCalculateIndependentRadii) << "calculateIndependentRadii: using uniform radii of" << radius
303 << "width" << rectWidth
304 << "height" << rectHeight
305 << "minDimension" << minDimension
306 << "tlr" << topLeftRadius
307 << "etlr" << effectiveTopLeftRadius
308 << "trr" << topRightRadius
309 << "etrr" << effectiveTopRightRadius
310 << "blr" << bottomLeftRadius
311 << "eblr" << effectiveBottomLeftRadius
312 << "brr" << bottomRightRadius
313 << "ebrr" << effectiveBottomRightRadius;
314 return;
315 }
316
317 // Mixed radii
318 qreal topLeftRadiusMin = qMin(minDimension, topLeftRadius);
319 qreal topRightRadiusMin = qMin(minDimension, topRightRadius);
320 qreal bottomLeftRadiusMin = qMin(minDimension, bottomLeftRadius);
321 qreal bottomRightRadiusMin = qMin(minDimension, bottomRightRadius);
322
323 // Top radii
324 const qreal topRadii = topLeftRadius + topRightRadius;
325
326 if (topRadii > rectWidth) {
327 const qreal topLeftRadiusFactor = topLeftRadius / topRadii;
328 const qreal tlr = qRound(rectWidth * topLeftRadiusFactor);
329
330 topLeftRadiusMin = qMin(topLeftRadiusMin, tlr);
331 topRightRadiusMin = qMin(topRightRadiusMin, rectWidth - tlr);
332 }
333
334 // Right radii
335 const qreal rightRadii = topRightRadius + bottomRightRadius;
336
337 if (rightRadii > rectHeight) {
338 const qreal topRightRadiusFactor = topRightRadius / rightRadii;
339 const qreal trr = qRound(rectHeight * topRightRadiusFactor);
340
341 topRightRadiusMin = qMin(topRightRadiusMin, trr);
342 bottomRightRadiusMin = qMin(bottomRightRadiusMin, rectHeight - trr);
343 }
344
345 // Bottom radii
346 const qreal bottomRadii = bottomRightRadius + bottomLeftRadius;
347
348 if (bottomRadii > rectWidth) {
349 const qreal bottomRightRadiusFactor = bottomRightRadius / bottomRadii;
350 const qreal brr = qRound(rectWidth * bottomRightRadiusFactor);
351
352 bottomRightRadiusMin = qMin(bottomRightRadiusMin, brr);
353 bottomLeftRadiusMin = qMin(bottomLeftRadiusMin, rectWidth - brr);
354 }
355
356 // Left radii
357 const qreal leftRadii = bottomLeftRadius + topLeftRadius;
358
359 if (leftRadii > rectHeight) {
360 const qreal bottomLeftRadiusFactor = bottomLeftRadius / leftRadii;
361 const qreal blr = qRound(rectHeight * bottomLeftRadiusFactor);
362
363 bottomLeftRadiusMin = qMin(bottomLeftRadiusMin, blr);
364 topLeftRadiusMin = qMin(topLeftRadiusMin, rectHeight - blr);
365 }
366
367 effectiveTopLeftRadius = topLeftRadiusMin;
368 effectiveTopRightRadius = topRightRadiusMin;
369 effectiveBottomLeftRadius = bottomLeftRadiusMin;
370 effectiveBottomRightRadius = bottomRightRadiusMin;
371
372 qCDebug(lcCalculateIndependentRadii) << "calculateIndependentRadii:"
373 << "width" << rectWidth
374 << "height" << rectHeight
375 << "borderMode" << borderMode
376 << "strokeWidth" << shapePath->strokeWidth()
377 << "minDimension" << minDimension
378 << "tlr" << topLeftRadius
379 << "etlr" << effectiveTopLeftRadius
380 << "trr" << topRightRadius
381 << "etrr" << effectiveTopRightRadius
382 << "blr" << bottomLeftRadius
383 << "eblr" << effectiveBottomLeftRadius
384 << "brr" << bottomRightRadius
385 << "ebrr" << effectiveBottomRightRadius
386 << "borderOffset" << borderOffset
387 << "startX" << shapePath->startX()
388 << "startY" << shapePath->startY();
389}
390
391/*!
392 \qmltype RectangleShape
393 \inqmlmodule QtQuick.Shapes.DesignHelpers
394 \brief A filled rectangle with an optional border.
395 \since QtQuick 6.10
396
397 RectangleShape is used to fill areas with solid color or gradients and to
398 provide a rectangular border.
399
400 Each Rectangle item is painted using either a solid fill color, specified
401 using the \l fillColor property, or a gradient, defined using one of the \l
402 ShapeGradient subtypes and set using the \l gradient property. If both a
403 color and a gradient are specified, the gradient is used.
404
405 An optional border can be added to a rectangle with its own color and
406 thickness by setting the \l strokeColor and \l strokeWidth properties.
407 Setting the color to \c transparent creates a border without a fill color.
408
409 Rounded rectangles can be drawn using the \l radius property. The radius
410 can also be specified separately for each corner. Additionally, \l bevel
411 can be applied on any corner to cut it off sharply.
412
413 RectangleShape's default value for \l {QtQuick.Shapes::Shape::preferredRendererType} is
414 \c Shape.CurveRenderer.
415
416 \section1 Example Usage
417
418 \snippet rectangleshape-bevel.qml rectangleShape
419
420 \image pathrectangle-bevel.png {Green rectangle with beveled corners}
421*/
422
423QQuickRectangleShape::QQuickRectangleShape(QQuickItem *parent)
424 : QQuickShape(*(new QQuickRectangleShapePrivate), parent)
425{
426 Q_D(QQuickRectangleShape);
427
428 // Create the ShapePath.
429 d->shapePath = new QQuickShapePath(this);
430 d->shapePath->setObjectName("rectangleShapeShapePath");
431 d->shapePath->setStrokeWidth(1);
432 d->shapePath->setStrokeColor(QColorConstants::Black);
433 d->shapePath->setFillColor(QColorConstants::White);
434 d->shapePath->setJoinStyle(QQuickShapePath::BevelJoin);
435 // Don't make it asynchronous, as it results in brief periods of incorrect rendering.
436
437 connect(d->shapePath, &QQuickShapePath::strokeColorChanged, this, &QQuickRectangleShape::strokeColorChanged);
438 connect(d->shapePath, &QQuickShapePath::strokeWidthChanged, this, &QQuickRectangleShape::strokeWidthChanged);
439 connect(d->shapePath, &QQuickShapePath::fillColorChanged, this, &QQuickRectangleShape::fillColorChanged);
440 connect(d->shapePath, &QQuickShapePath::joinStyleChanged, this, &QQuickRectangleShape::joinStyleChanged);
441 connect(d->shapePath, &QQuickShapePath::capStyleChanged, this, &QQuickRectangleShape::capStyleChanged);
442 connect(d->shapePath, &QQuickShapePath::strokeStyleChanged, this, &QQuickRectangleShape::strokeStyleChanged);
443 connect(d->shapePath, &QQuickShapePath::dashOffsetChanged, this, &QQuickRectangleShape::dashOffsetChanged);
444 connect(d->shapePath, &QQuickShapePath::dashPatternChanged, this, &QQuickRectangleShape::dashPatternChanged);
445 connect(d->shapePath, &QQuickShapePath::fillItemChanged, this, &QQuickRectangleShape::fillItemChanged);
446 connect(d->shapePath, &QQuickShapePath::fillGradientChanged, this, &QQuickRectangleShape::fillGradientChanged);
447
448 // Add the path as a child of us.
449 // The individual path elements will be added to the shape path in maybeUpdateElements().
450 // Do what vpe_append in qquickshape.cpp does except without the overhead of the QQmlListProperty stuff.
451 d->sp.append(d->shapePath);
452 // Similar, but for QQuickItemPrivate::data_append...
453 d->shapePath->setParent(this);
454 // ... which calls QQuickItemPrivate::resources_append.
455 d->extra.value().resourcesList.append(d->shapePath);
456
457 setWidth(200);
458 setHeight(200);
459 setPreferredRendererType(CurveRenderer);
460
461 // QQuickShape::componentComplete sets up the connections to each path.
462 // It also calls _q_shapePathChanged, which will call polish (for our updatePolish).
463}
464
465QQuickRectangleShape::~QQuickRectangleShape()
466{
467}
468
469/*!
470 \since 6.11
471 \qmlproperty bool QtQuick.Shapes.DesignHelpers::RectangleShape::drawTop
472
473 This property holds whether the top border is drawn.
474
475 The default value is \c true.
476*/
477bool QQuickRectangleShape::drawTop() const
478{
479 Q_D(const QQuickRectangleShape);
480 return d->drawTop;
481}
482
483void QQuickRectangleShape::setDrawTop(bool drawTop)
484{
485 Q_D(QQuickRectangleShape);
486 if (drawTop == d->drawTop)
487 return;
488
489 d->drawTop = drawTop;
490 d->maybeUpdateElements();
491 emit drawTopChanged();
492}
493
494void QQuickRectangleShape::resetDrawTop()
495{
496 setDrawTop(QQuickRectangleShapePrivate::defaultDrawEdge);
497}
498
499/*!
500 \since 6.11
501 \qmlproperty bool QtQuick.Shapes.DesignHelpers::RectangleShape::drawRight
502
503 This property holds whether the right border is drawn.
504
505 The default value is \c true.
506*/
507bool QQuickRectangleShape::drawRight() const
508{
509 Q_D(const QQuickRectangleShape);
510 return d->drawRight;
511}
512
513void QQuickRectangleShape::setDrawRight(bool drawRight)
514{
515 Q_D(QQuickRectangleShape);
516 if (drawRight == d->drawRight)
517 return;
518
519 d->drawRight = drawRight;
520 d->maybeUpdateElements();
521 emit drawRightChanged();
522}
523
524void QQuickRectangleShape::resetDrawRight()
525{
526 setDrawRight(QQuickRectangleShapePrivate::defaultDrawEdge);
527}
528
529/*!
530 \since 6.11
531 \qmlproperty bool QtQuick.Shapes.DesignHelpers::RectangleShape::drawBottom
532
533 This property holds whether the bottom border is drawn.
534
535 The default value is \c true.
536*/
537bool QQuickRectangleShape::drawBottom() const
538{
539 Q_D(const QQuickRectangleShape);
540 return d->drawBottom;
541}
542
543void QQuickRectangleShape::setDrawBottom(bool drawBottom)
544{
545 Q_D(QQuickRectangleShape);
546 if (drawBottom == d->drawBottom)
547 return;
548
549 d->drawBottom = drawBottom;
550 d->maybeUpdateElements();
551 emit drawBottomChanged();
552}
553
554void QQuickRectangleShape::resetDrawBottom()
555{
556 setDrawBottom(QQuickRectangleShapePrivate::defaultDrawEdge);
557}
558
559/*!
560 \since 6.11
561 \qmlproperty bool QtQuick.Shapes.DesignHelpers::RectangleShape::drawLeft
562
563 This property holds whether the left border is drawn.
564
565 The default value is \c true.
566*/
567bool QQuickRectangleShape::drawLeft() const
568{
569 Q_D(const QQuickRectangleShape);
570 return d->drawLeft;
571}
572
573void QQuickRectangleShape::setDrawLeft(bool drawLeft)
574{
575 Q_D(QQuickRectangleShape);
576 if (drawLeft == d->drawLeft)
577 return;
578
579 d->drawLeft = drawLeft;
580 d->maybeUpdateElements();
581 emit drawLeftChanged();
582}
583
584void QQuickRectangleShape::resetDrawLeft()
585{
586 setDrawLeft(QQuickRectangleShapePrivate::defaultDrawEdge);
587}
588
589/*!
590 \include pathrectangle.qdocinc {radius-property}
591 {QtQuick.Shapes.DesignHelpers::RectangleShape}
592
593 If radius is a positive value, the rectangle path will be defined as a rounded rectangle,
594 otherwise it will be defined as a normal rectangle.
595
596 The default value is \c 10.
597*/
598
599int QQuickRectangleShape::radius() const
600{
601 Q_D(const QQuickRectangleShape);
602 return d->radius;
603}
604
605void QQuickRectangleShape::setRadius(int radius)
606{
607 Q_D(QQuickRectangleShape);
608 if (radius == d->radius)
609 return;
610
611 const int oldTopLeftRadius = topLeftRadius();
612 const int oldTopRightRadius = topRightRadius();
613 const int oldBottomRightRadius = bottomRightRadius();
614 const int oldBottomLeftRadius = bottomLeftRadius();
615
616 d->radius = radius;
617 polish();
618 emit radiusChanged();
619 if (topLeftRadius() != oldTopLeftRadius)
620 emit topLeftRadiusChanged();
621 if (topRightRadius() != oldTopRightRadius)
622 emit topRightRadiusChanged();
623 if (bottomRightRadius() != oldBottomRightRadius)
624 emit bottomRightRadiusChanged();
625 if (bottomLeftRadius() != oldBottomLeftRadius)
626 emit bottomLeftRadiusChanged();
627}
628
629void QQuickRectangleShape::resetRadius()
630{
631 setRadius(QQuickRectangleShapePrivate::defaultRadius);
632}
633
634/*!
635 \include pathrectangle.qdocinc {radius-properties}
636 {QtQuick.Shapes.DesignHelpers::RectangleShape} {rectangleshape.qml} {rectangleShape}
637*/
638
639int QQuickRectangleShape::topLeftRadius() const
640{
641 Q_D(const QQuickRectangleShape);
642 return d->explicitTopLeftRadius ? d->topLeftRadius : d->radius;
643}
644
645void QQuickRectangleShape::setTopLeftRadius(int topLeftRadius)
646{
647 Q_D(QQuickRectangleShape);
648 d->setTopLeftRadius(topLeftRadius, QQml::PropertyUtils::State::ExplicitlySet);
649}
650
651void QQuickRectangleShape::resetTopLeftRadius()
652{
653 Q_D(QQuickRectangleShape);
654 d->setTopLeftRadius(QQuickRectangleShapePrivate::defaultRadius,
655 QQml::PropertyUtils::State::ImplicitlySet);
656}
657
658int QQuickRectangleShape::topRightRadius() const
659{
660 Q_D(const QQuickRectangleShape);
661 return d->explicitTopRightRadius ? d->topRightRadius : d->radius;
662}
663
664void QQuickRectangleShape::setTopRightRadius(int topRightRadius)
665{
666 Q_D(QQuickRectangleShape);
667 d->setTopRightRadius(topRightRadius, QQml::PropertyUtils::State::ExplicitlySet);
668}
669
670void QQuickRectangleShape::resetTopRightRadius()
671{
672 Q_D(QQuickRectangleShape);
673 d->setTopRightRadius(QQuickRectangleShapePrivate::defaultRadius,
674 QQml::PropertyUtils::State::ImplicitlySet);
675}
676
677int QQuickRectangleShape::bottomLeftRadius() const
678{
679 Q_D(const QQuickRectangleShape);
680 return d->explicitBottomLeftRadius ? d->bottomLeftRadius : d->radius;
681}
682
683void QQuickRectangleShape::setBottomLeftRadius(int bottomLeftRadius)
684{
685 Q_D(QQuickRectangleShape);
686 d->setBottomLeftRadius(bottomLeftRadius, QQml::PropertyUtils::State::ExplicitlySet);
687}
688
689void QQuickRectangleShape::resetBottomLeftRadius()
690{
691 Q_D(QQuickRectangleShape);
692 d->setBottomLeftRadius(QQuickRectangleShapePrivate::defaultRadius,
693 QQml::PropertyUtils::State::ImplicitlySet);
694}
695
696int QQuickRectangleShape::bottomRightRadius() const
697{
698 Q_D(const QQuickRectangleShape);
699 return d->explicitBottomRightRadius ? d->bottomRightRadius : d->radius;
700}
701
702void QQuickRectangleShape::setBottomRightRadius(int bottomRightRadius)
703{
704 Q_D(QQuickRectangleShape);
705 d->setBottomRightRadius(bottomRightRadius, QQml::PropertyUtils::State::ExplicitlySet);
706}
707
708void QQuickRectangleShape::resetBottomRightRadius()
709{
710 Q_D(QQuickRectangleShape);
711 d->setBottomRightRadius(QQuickRectangleShapePrivate::defaultRadius,
712 QQml::PropertyUtils::State::ImplicitlySet);
713}
714
715/*!
716 \include pathrectangle.qdocinc {bevel-property}
717 {QtQuick.Shapes.DesignHelpers::RectangleShape}
718 {rectangleshape-bevel.qml}{rectangleShape}
719*/
720
721bool QQuickRectangleShape::hasBevel() const
722{
723 Q_D(const QQuickRectangleShape);
724 return d->bevel;
725}
726
727void QQuickRectangleShape::setBevel(bool bevel)
728{
729 Q_D(QQuickRectangleShape);
730 if (bevel == d->bevel)
731 return;
732
733 const bool oldTopLeftBevel = hasTopLeftBevel();
734 const bool oldTopRightBevel = hasTopRightBevel();
735 const bool oldBottomRightBevel = hasBottomRightBevel();
736 const bool oldBottomLeftBevel = hasBottomLeftBevel();
737
738 d->bevel = bevel;
739 polish();
740 emit bevelChanged();
741 if (hasTopLeftBevel() != oldTopLeftBevel)
742 emit topLeftBevelChanged();
743 if (hasTopRightBevel() != oldTopRightBevel)
744 emit topRightBevelChanged();
745 if (hasBottomRightBevel() != oldBottomRightBevel)
746 emit bottomRightBevelChanged();
747 if (hasBottomLeftBevel() != oldBottomLeftBevel)
748 emit bottomLeftBevelChanged();
749}
750
751void QQuickRectangleShape::resetBevel()
752{
753 setBevel(false);
754}
755
756/*!
757 \include pathrectangle.qdocinc {bevel-properties}
758 {QtQuick.Shapes.DesignHelpers::RectangleShape}
759 {rectangleshape.qml} {rectangleShape}
760*/
761
762bool QQuickRectangleShape::hasTopLeftBevel() const
763{
764 Q_D(const QQuickRectangleShape);
765 return d->explicitTopLeftBevel ? d->topLeftBevel : d->bevel;
766}
767
768void QQuickRectangleShape::setTopLeftBevel(bool topLeftBevel)
769{
770 Q_D(QQuickRectangleShape);
771 d->setTopLeftBevel(topLeftBevel, QQml::PropertyUtils::State::ExplicitlySet);
772}
773
774void QQuickRectangleShape::resetTopLeftBevel()
775{
776 Q_D(QQuickRectangleShape);
777 d->setTopLeftBevel(QQuickRectangleShapePrivate::defaultBevel,
778 QQml::PropertyUtils::State::ImplicitlySet);
779}
780
781bool QQuickRectangleShape::hasTopRightBevel() const
782{
783 Q_D(const QQuickRectangleShape);
784 return d->explicitTopRightBevel ? d->topRightBevel : d->bevel;
785}
786
787void QQuickRectangleShape::setTopRightBevel(bool topRightBevel)
788{
789 Q_D(QQuickRectangleShape);
790 d->setTopRightBevel(topRightBevel, QQml::PropertyUtils::State::ExplicitlySet);
791}
792
793void QQuickRectangleShape::resetTopRightBevel()
794{
795 Q_D(QQuickRectangleShape);
796 d->setTopRightBevel(QQuickRectangleShapePrivate::defaultBevel,
797 QQml::PropertyUtils::State::ImplicitlySet);
798}
799
800bool QQuickRectangleShape::hasBottomLeftBevel() const
801{
802 Q_D(const QQuickRectangleShape);
803 return d->explicitBottomLeftBevel ? d->bottomLeftBevel : d->bevel;
804}
805
806void QQuickRectangleShape::setBottomLeftBevel(bool bottomLeftBevel)
807{
808 Q_D(QQuickRectangleShape);
809 d->setBottomLeftBevel(bottomLeftBevel, QQml::PropertyUtils::State::ExplicitlySet);
810}
811
812void QQuickRectangleShape::resetBottomLeftBevel()
813{
814 Q_D(QQuickRectangleShape);
815 d->setBottomLeftBevel(QQuickRectangleShapePrivate::defaultBevel,
816 QQml::PropertyUtils::State::ImplicitlySet);
817}
818
819bool QQuickRectangleShape::hasBottomRightBevel() const
820{
821 Q_D(const QQuickRectangleShape);
822 return d->explicitBottomRightBevel ? d->bottomRightBevel : d->bevel;
823}
824
825void QQuickRectangleShape::setBottomRightBevel(bool bottomRightBevel)
826{
827 Q_D(QQuickRectangleShape);
828 d->setBottomRightBevel(bottomRightBevel, QQml::PropertyUtils::State::ExplicitlySet);
829}
830
831void QQuickRectangleShape::resetBottomRightBevel()
832{
833 Q_D(QQuickRectangleShape);
834 d->setBottomRightBevel(QQuickRectangleShapePrivate::defaultBevel,
835 QQml::PropertyUtils::State::ImplicitlySet);
836}
837
838/*!
839 \qmlproperty color QtQuick.Shapes.DesignHelpers::RectangleShape::strokeColor
840
841 This property holds the stroking color.
842
843 When set to \c transparent, no stroking occurs.
844
845 The default value is \c "black".
846*/
847
848QColor QQuickRectangleShape::strokeColor() const
849{
850 Q_D(const QQuickRectangleShape);
851 return d->shapePath->strokeColor();
852}
853
854void QQuickRectangleShape::setStrokeColor(const QColor &color)
855{
856 Q_D(QQuickRectangleShape);
857 d->shapePath->setStrokeColor(color);
858}
859
860/*!
861 \qmlproperty real QtQuick.Shapes.DesignHelpers::RectangleShape::strokeWidth
862
863 This property holds the stroke width.
864
865 When set to a negative value, no stroking occurs.
866
867 The default value is \c 1.
868*/
869
870qreal QQuickRectangleShape::strokeWidth() const
871{
872 Q_D(const QQuickRectangleShape);
873 return d->shapePath->strokeWidth();
874}
875
876void QQuickRectangleShape::setStrokeWidth(qreal width)
877{
878 Q_D(QQuickRectangleShape);
879 d->shapePath->setStrokeWidth(width);
880}
881
882/*!
883 \qmlproperty color QtQuick.Shapes.DesignHelpers::RectangleShape::fillColor
884
885 This property holds the fill color.
886
887 When set to \c transparent, no filling occurs.
888
889 The default value is \c "white".
890
891 \note If either \l fillGradient is set to something other than \c null, it
892 will be used instead of \c fillColor.
893*/
894
895QColor QQuickRectangleShape::fillColor() const
896{
897 Q_D(const QQuickRectangleShape);
898 return d->shapePath->fillColor();
899}
900
901void QQuickRectangleShape::setFillColor(const QColor &color)
902{
903 Q_D(QQuickRectangleShape);
904 d->shapePath->setFillColor(color);
905}
906
907/*!
908 \include shapepath.qdocinc {fillRule-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
909*/
910
911QQuickShapePath::FillRule QQuickRectangleShape::fillRule() const
912{
913 Q_D(const QQuickRectangleShape);
914 return d->shapePath->fillRule();
915}
916
917void QQuickRectangleShape::setFillRule(QQuickShapePath::FillRule fillRule)
918{
919 Q_D(QQuickRectangleShape);
920 d->shapePath->setFillRule(fillRule);
921}
922
923/*!
924 \include shapepath.qdocinc {joinStyle-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
925*/
926
927QQuickShapePath::JoinStyle QQuickRectangleShape::joinStyle() const
928{
929 Q_D(const QQuickRectangleShape);
930 return d->shapePath->joinStyle();
931}
932
933void QQuickRectangleShape::setJoinStyle(QQuickShapePath::JoinStyle style)
934{
935 Q_D(QQuickRectangleShape);
936 d->shapePath->setJoinStyle(style);
937}
938
939int QQuickRectangleShape::miterLimit() const
940{
941 Q_D(const QQuickRectangleShape);
942 return d->shapePath->miterLimit();
943}
944
945void QQuickRectangleShape::setMiterLimit(int limit)
946{
947 Q_D(QQuickRectangleShape);
948 d->shapePath->setMiterLimit(limit);
949}
950
951/*!
952 \include shapepath.qdocinc {capStyle-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
953*/
954
955QQuickShapePath::CapStyle QQuickRectangleShape::capStyle() const
956{
957 Q_D(const QQuickRectangleShape);
958 return d->shapePath->capStyle();
959}
960
961void QQuickRectangleShape::setCapStyle(QQuickShapePath::CapStyle style)
962{
963 Q_D(QQuickRectangleShape);
964 d->shapePath->setCapStyle(style);
965}
966
967/*!
968 \include shapepath.qdocinc {strokeStyle-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
969*/
970
971QQuickShapePath::StrokeStyle QQuickRectangleShape::strokeStyle() const
972{
973 Q_D(const QQuickRectangleShape);
974 return d->shapePath->strokeStyle();
975}
976
977void QQuickRectangleShape::setStrokeStyle(QQuickShapePath::StrokeStyle style)
978{
979 Q_D(QQuickRectangleShape);
980 d->shapePath->setStrokeStyle(style);
981}
982
983/*!
984 \include shapepath.qdocinc {dashOffset-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
985*/
986
987qreal QQuickRectangleShape::dashOffset() const
988{
989 Q_D(const QQuickRectangleShape);
990 return d->shapePath->dashOffset();
991}
992
993void QQuickRectangleShape::setDashOffset(qreal offset)
994{
995 Q_D(QQuickRectangleShape);
996 d->shapePath->setDashOffset(offset);
997}
998
999/*!
1000 \include shapepath.qdocinc {dashPattern-property} {QtQuick.Shapes.DesignHelpers::RectangleShape}
1001*/
1002
1003QList<qreal> QQuickRectangleShape::dashPattern() const
1004{
1005 Q_D(const QQuickRectangleShape);
1006 return d->shapePath->dashPattern();
1007}
1008
1009void QQuickRectangleShape::setDashPattern(const QList<qreal> &array)
1010{
1011 Q_D(QQuickRectangleShape);
1012 d->shapePath->setDashPattern(array);
1013}
1014
1015/*!
1016 \qmlproperty ShapeGradient QtQuick.Shapes.DesignHelpers::RectangleShape::fillGradient
1017
1018 The fillGradient of the rectangle fill color.
1019
1020 By default, no fillGradient is enabled and the value is null. In this case, the
1021 fill uses a solid color based on the value of \l fillColor.
1022
1023 When set, \l fillColor is ignored and filling is done using one of the
1024 \l ShapeGradient subtypes.
1025
1026 \note The \l Gradient type cannot be used here. Rather, prefer using one of
1027 the advanced subtypes, like \l LinearGradient.
1028*/
1029QQuickShapeGradient *QQuickRectangleShape::fillGradient() const
1030{
1031 Q_D(const QQuickRectangleShape);
1032 return d->shapePath->fillGradient();
1033}
1034
1035void QQuickRectangleShape::setFillGradient(QQuickShapeGradient *fillGradient)
1036{
1037 Q_D(QQuickRectangleShape);
1038 d->shapePath->setFillGradient(fillGradient);
1039}
1040
1041void QQuickRectangleShape::resetFillGradient()
1042{
1043 setFillGradient(nullptr);
1044}
1045
1046/*!
1047 \qmlproperty enumeration QtQuick.Shapes.DesignHelpers::RectangleShape::borderMode
1048
1049 The \l borderMode property determines where the border is drawn along the
1050 edge of the rectangle.
1051
1052 \value RectangleShape.Inside
1053 The border is drawn along the inside edge of the item and does not
1054 affect the item width.
1055
1056 This is the default value.
1057 \value RectangleShape.Middle
1058 The border is drawn over the edge of the item and does not
1059 affect the item width.
1060 \value RectangleShape.Outside
1061 The border is drawn along the outside edge of the item and increases
1062 the item width by the value of \l strokeWidth.
1063
1064 \sa strokeWidth
1065*/
1066QQuickRectangleShape::BorderMode QQuickRectangleShape::borderMode() const
1067{
1068 Q_D(const QQuickRectangleShape);
1069 return d->borderMode;
1070}
1071
1072void QQuickRectangleShape::setBorderMode(BorderMode borderMode)
1073{
1074 Q_D(QQuickRectangleShape);
1075 if (borderMode == d->borderMode)
1076 return;
1077
1078 d->borderMode = borderMode;
1079 polish();
1080 emit borderModeChanged();
1081}
1082
1083void QQuickRectangleShape::resetBorderMode()
1084{
1085 setBorderMode(BorderMode::Inside);
1086}
1087
1088void QQuickRectangleShape::componentComplete()
1089{
1090 Q_D(QQuickRectangleShape);
1091 d->componentComplete = true;
1092 // Do this before componentComplete(), because we need the elements to be
1093 // present in order for the connections to them to be made.
1094 d->maybeUpdateElements();
1095 QQuickShape::componentComplete();
1096}
1097
1098QQuickItem *QQuickRectangleShape::fillItem() const
1099{
1100 Q_D(const QQuickRectangleShape);
1101 return d->shapePath->fillItem();
1102}
1103
1104void QQuickRectangleShape::setFillItem(QQuickItem *newFillItem)
1105{
1106 Q_D(QQuickRectangleShape);
1107 d->shapePath->setFillItem(newFillItem);
1108}
1109
1110void QQuickRectangleShape::itemChange(ItemChange change, const ItemChangeData &value)
1111{
1112 Q_D(QQuickRectangleShape);
1113 d->maybeUpdateElements();
1114
1115 QQuickItem::itemChange(change, value);
1116}
1117
1118void QQuickRectangleShape::updatePolish()
1119{
1120 Q_D(QQuickRectangleShape);
1121 const qreal rectWidth = d->width.valueBypassingBindings();
1122 const qreal rectHeight = d->height.valueBypassingBindings();
1123
1124 d->calculateIndependentRadii();
1125
1126 switch (d->borderMode) {
1127 case QQuickRectangleShape::BorderMode::Inside:
1128 d->borderOffset = d->shapePath->strokeWidth() * 0.5;
1129 break;
1130 case QQuickRectangleShape::BorderMode::Middle:
1131 d->borderOffset = 0;
1132 break;
1133 case QQuickRectangleShape::BorderMode::Outside:
1134 d->borderOffset = -d->shapePath->strokeWidth() * 0.5;
1135 break;
1136 }
1137
1138 switch (d->borderMode) {
1139 case QQuickRectangleShape::BorderMode::Outside:
1140 d->borderRadiusAdjustment = d->shapePath->strokeWidth() * 0.5;
1141 break;
1142 case QQuickRectangleShape::BorderMode::Middle:
1143 d->borderRadiusAdjustment = d->shapePath->strokeWidth();
1144 break;
1145 default:
1146 d->borderRadiusAdjustment = 0;
1147 break;
1148 }
1149
1150 switch (d->firstVisibleEdge) {
1151 case QQuickRectangleShapePrivate::Edge::Top:
1152 d->shapePath->setStartX(d->effectiveTopLeftRadius + d->borderOffset + d->borderRadiusAdjustment);
1153 d->shapePath->setStartY(d->borderOffset);
1154 break;
1155 case QQuickRectangleShapePrivate::Edge::Right:
1156 d->shapePath->setStartX(rectWidth - d->borderOffset);
1157 d->shapePath->setStartY(d->effectiveTopRightRadius + d->borderOffset + d->borderRadiusAdjustment);
1158 break;
1159 case QQuickRectangleShapePrivate::Edge::Bottom:
1160 d->shapePath->setStartX(rectWidth - d->effectiveBottomRightRadius - d->borderOffset - d->borderRadiusAdjustment);
1161 d->shapePath->setStartY(rectHeight - d->borderOffset);
1162 break;
1163 case QQuickRectangleShapePrivate::Edge::Left:
1164 d->shapePath->setStartX(d->borderOffset);
1165 d->shapePath->setStartY(rectHeight - d->effectiveBottomLeftRadius - d->borderOffset - d->borderRadiusAdjustment);
1166 break;
1167 default:
1168 Q_UNREACHABLE();
1169 }
1170
1171 if (d->topPathLine) {
1172 d->topPathLine->setX(rectWidth - d->effectiveTopRightRadius - d->borderOffset - d->borderRadiusAdjustment);
1173 d->topPathLine->setY(d->borderOffset);
1174 } else {
1175 d->topPathMove->setX(rectWidth - d->borderOffset);
1176 d->topPathMove->setY(d->effectiveTopRightRadius + d->borderOffset + d->borderRadiusAdjustment);
1177 }
1178
1179 if (d->topRightPathArc) {
1180 d->topRightPathArc->setX(rectWidth - d->borderOffset);
1181 d->topRightPathArc->setY(d->effectiveTopRightRadius + d->borderOffset + d->borderRadiusAdjustment);
1182 const bool topRightBevel = hasTopRightBevel();
1183 d->topRightPathArc->setRadiusX(topRightBevel ? 50000 : d->effectiveTopRightRadius + d->borderRadiusAdjustment);
1184 d->topRightPathArc->setRadiusY(topRightBevel ? 50000 : d->effectiveTopRightRadius + d->borderRadiusAdjustment);
1185 }
1186
1187 if (d->rightPathLine) {
1188 d->rightPathLine->setX(rectWidth - d->borderOffset);
1189 d->rightPathLine->setY(rectHeight - d->effectiveBottomRightRadius - d->borderOffset - d->borderRadiusAdjustment);
1190 } else {
1191 d->rightPathMove->setX(rectWidth - d->effectiveBottomRightRadius - d->borderOffset - d->borderRadiusAdjustment);
1192 d->rightPathMove->setY(rectHeight - d->borderOffset);
1193 }
1194
1195 if (d->bottomRightPathArc) {
1196 d->bottomRightPathArc->setX(rectWidth - d->effectiveBottomRightRadius - d->borderOffset - d->borderRadiusAdjustment);
1197 d->bottomRightPathArc->setY(rectHeight - d->borderOffset);
1198 const bool bottomRightBevel = hasBottomRightBevel();
1199 d->bottomRightPathArc->setRadiusX(bottomRightBevel ? 50000 : d->effectiveBottomRightRadius + d->borderRadiusAdjustment);
1200 d->bottomRightPathArc->setRadiusY(bottomRightBevel ? 50000 : d->effectiveBottomRightRadius + d->borderRadiusAdjustment);
1201 }
1202
1203 if (d->bottomPathLine) {
1204 d->bottomPathLine->setX(d->effectiveBottomLeftRadius + d->borderOffset + d->borderRadiusAdjustment);
1205 d->bottomPathLine->setY(rectHeight - d->borderOffset);
1206 } else {
1207 d->bottomPathMove->setX(d->borderOffset);
1208 d->bottomPathMove->setY(rectHeight - d->effectiveBottomLeftRadius - d->borderOffset - d->borderRadiusAdjustment);
1209 }
1210
1211 if (d->bottomLeftPathArc) {
1212 d->bottomLeftPathArc->setX(d->borderOffset);
1213 d->bottomLeftPathArc->setY(rectHeight - d->effectiveBottomLeftRadius - d->borderOffset - d->borderRadiusAdjustment);
1214 const bool bottomLeftBevel = hasBottomLeftBevel();
1215 d->bottomLeftPathArc->setRadiusX(bottomLeftBevel ? 50000 : d->effectiveBottomLeftRadius + d->borderRadiusAdjustment);
1216 d->bottomLeftPathArc->setRadiusY(bottomLeftBevel ? 50000 : d->effectiveBottomLeftRadius + d->borderRadiusAdjustment);
1217 }
1218
1219 if (d->leftPathLine) {
1220 d->leftPathLine->setX(d->borderOffset);
1221 d->leftPathLine->setY(d->effectiveTopLeftRadius + d->borderOffset + d->borderRadiusAdjustment);
1222 }
1223
1224 if (d->topLeftPathArc) {
1225 d->topLeftPathArc->setX(d->effectiveTopLeftRadius + d->borderOffset + d->borderRadiusAdjustment);
1226 d->topLeftPathArc->setY(d->borderOffset);
1227 const bool topLeftBevel = hasTopLeftBevel();
1228 d->topLeftPathArc->setRadiusX(topLeftBevel ? 50000 : d->effectiveTopLeftRadius + d->borderRadiusAdjustment);
1229 d->topLeftPathArc->setRadiusY(topLeftBevel ? 50000 : d->effectiveTopLeftRadius + d->borderRadiusAdjustment);
1230 }
1231
1232 // This does stuff with each path, so we want to call it after we've made our own changes.
1233 QQuickShape::updatePolish();
1234
1235 qCDebug(lcUpdatePolish) << "updatePolish:"
1236 << "width" << rectWidth
1237 << "height" << rectHeight
1238 << "borderMode" << d->borderMode
1239 << "strokeWidth" << d->shapePath->strokeWidth()
1240 << "etlr" << d->effectiveTopLeftRadius
1241 << "etrr" << d->effectiveTopRightRadius
1242 << "eblr" << d->effectiveBottomLeftRadius
1243 << "ebrr" << d->effectiveBottomRightRadius
1244 << "borderOffset" << d->borderOffset
1245 << "startX" << d->shapePath->startX()
1246 << "startY" << d->shapePath->startY();
1247}
1248
1249QT_END_NAMESPACE
1250
1251#include "moc_qquickrectangleshape_p.cpp"
Combined button and popup list for selecting options.
T * createElement(QQuickShapePath *shapePath, const char *objectName)