Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickshape.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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#include "qquickshape_p.h"
5#include "qquickshape_p_p.h"
9#include <private/qsgplaintexture_p.h>
10#include <private/qquicksvgparser_p.h>
11#include <QtGui/private/qdrawhelper_p.h>
12#include <QOpenGLFunctions>
13#include <QLoggingCategory>
14#include <rhi/qrhi.h>
15
16static void initResources()
17{
18#if defined(QT_STATIC)
19 Q_INIT_RESOURCE(qtquickshapes_shaders);
20#endif
21}
22
24
25Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync")
26
27
66{
68}
69
71
72void QQuickShapesModule::defineModule()
73{
75}
76
78 : strokeColor(Qt::white),
79 strokeWidth(1),
80 fillColor(Qt::white),
81 fillRule(QQuickShapePath::OddEvenFill),
82 joinStyle(QQuickShapePath::BevelJoin),
83 miterLimit(2),
84 capStyle(QQuickShapePath::SquareCap),
85 strokeStyle(QQuickShapePath::SolidLine),
86 dashOffset(0),
87 fillGradient(nullptr)
88{
89 dashPattern << 4 << 2; // 4 * strokeWidth dash followed by 2 * strokeWidth space
90}
91
95
152 : dirty(DirtyAll)
153{
154 // Set this QQuickPath to be a ShapePath
155 isShapePath = true;
156}
157
160{
161 // The inherited changed() and the shapePathChanged() signals remain
162 // distinct, and this is intentional. Combining the two is not possible due
163 // to the difference in semantics and the need to act (see dirty flag
164 // below) differently on QQuickPath-related changes.
165
166 connect(this, &QQuickPath::changed, [this]() {
167 Q_D(QQuickShapePath);
170 });
171}
172
174{
175}
176
188{
189 Q_D(const QQuickShapePath);
190 return d->sfp.strokeColor;
191}
192
194{
195 Q_D(QQuickShapePath);
196 if (d->sfp.strokeColor != color) {
197 d->sfp.strokeColor = color;
201 }
202}
203
215{
216 Q_D(const QQuickShapePath);
217 return d->sfp.strokeWidth;
218}
219
221{
222 Q_D(QQuickShapePath);
223 if (d->sfp.strokeWidth != w) {
224 d->sfp.strokeWidth = w;
228 }
229}
230
242{
243 Q_D(const QQuickShapePath);
244 return d->sfp.fillColor;
245}
246
248{
249 Q_D(QQuickShapePath);
250 if (d->sfp.fillColor != color) {
251 d->sfp.fillColor = color;
255 }
256}
257
273{
274 Q_D(const QQuickShapePath);
275 return d->sfp.fillRule;
276}
277
279{
280 Q_D(QQuickShapePath);
281 if (d->sfp.fillRule != fillRule) {
282 d->sfp.fillRule = fillRule;
286 }
287}
288
307{
308 Q_D(const QQuickShapePath);
309 return d->sfp.joinStyle;
310}
311
313{
314 Q_D(QQuickShapePath);
315 if (d->sfp.joinStyle != style) {
316 d->sfp.joinStyle = style;
320 }
321}
322
333{
334 Q_D(const QQuickShapePath);
335 return d->sfp.miterLimit;
336}
337
339{
340 Q_D(QQuickShapePath);
341 if (d->sfp.miterLimit != limit) {
342 d->sfp.miterLimit = limit;
346 }
347}
348
367{
368 Q_D(const QQuickShapePath);
369 return d->sfp.capStyle;
370}
371
373{
374 Q_D(QQuickShapePath);
375 if (d->sfp.capStyle != style) {
376 d->sfp.capStyle = style;
380 }
381}
382
394{
395 Q_D(const QQuickShapePath);
396 return d->sfp.strokeStyle;
397}
398
400{
401 Q_D(QQuickShapePath);
402 if (d->sfp.strokeStyle != style) {
403 d->sfp.strokeStyle = style;
407 }
408}
409
422{
423 Q_D(const QQuickShapePath);
424 return d->sfp.dashOffset;
425}
426
428{
429 Q_D(QQuickShapePath);
430 if (d->sfp.dashOffset != offset) {
431 d->sfp.dashOffset = offset;
435 }
436}
437
453{
454 Q_D(const QQuickShapePath);
455 return d->sfp.dashPattern;
456}
457
459{
460 Q_D(QQuickShapePath);
461 if (d->sfp.dashPattern != array) {
462 d->sfp.dashPattern = array;
466 }
467}
468
484{
485 Q_D(const QQuickShapePath);
486 return d->sfp.fillGradient;
487}
488
490{
491 Q_D(QQuickShapePath);
492 if (d->sfp.fillGradient != gradient) {
493 if (d->sfp.fillGradient)
494 qmlobject_disconnect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
495 this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
496 d->sfp.fillGradient = gradient;
497 if (d->sfp.fillGradient)
498 qmlobject_connect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
499 this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
502 }
503}
504
506{
507 Q_Q(QQuickShapePath);
509 emit q->shapePathChanged();
510}
511
513{
514 setFillGradient(nullptr);
515}
516
520
629 : effectRefCount(0)
630{
631}
632
634{
635 delete renderer;
636}
637
639{
640 Q_Q(QQuickShape);
641 spChanged = true;
642 q->polish();
643 emit q->boundingRectChanged();
644}
645
647{
648 Q_Q(QQuickShape);
649 if (status != newStatus) {
650 status = newStatus;
651 emit q->statusChanged();
652 }
653}
654
657{
659}
660
662{
663}
664
726{
727 Q_D(const QQuickShape);
728 return d->rendererType;
729}
730
753{
754 Q_D(const QQuickShape);
755 return d->preferredType;
756}
757
758void QQuickShape::setPreferredRendererType(QQuickShape::RendererType preferredType)
759{
760 Q_D(QQuickShape);
761 if (d->preferredType == preferredType)
762 return;
763
764 d->preferredType = preferredType;
765 // (could bail out here if selectRenderType shows no change?)
766
767 for (int i = 0; i < d->sp.size(); ++i) {
768 QQuickShapePath *p = d->sp[i];
771 }
772 d->spChanged = true;
773 d->_q_shapePathChanged();
774 polish();
775 update();
776
777 emit preferredRendererTypeChanged();
778}
779
780
798{
799 Q_D(const QQuickShape);
800 return d->async;
801}
802
804{
805 Q_D(QQuickShape);
806 if (d->async != async) {
807 d->async = async;
809 if (d->componentComplete)
810 d->_q_shapePathChanged();
811 }
812}
813
821{
822 Q_D(const QQuickShape);
823 QRectF brect;
824 for (QQuickShapePath *path : d->sp) {
825 brect = brect.united(path->path().boundingRect());
826 }
827
828 return brect;
829}
830
842{
843 Q_D(const QQuickShape);
844 return d->enableVendorExts;
845}
846
848{
849 Q_D(QQuickShape);
850 if (d->enableVendorExts != enable) {
851 d->enableVendorExts = enable;
853 }
854}
855
873{
874 Q_D(const QQuickShape);
875 return d->status;
876}
877
904{
905 Q_D(const QQuickShape);
906 return d->containsMode;
907}
908
910{
911 Q_D(QQuickShape);
912 if (d->containsMode == containsMode)
913 return;
914
915 d->containsMode = containsMode;
916 emit containsModeChanged();
917}
918
919bool QQuickShape::contains(const QPointF &point) const
920{
921 Q_D(const QQuickShape);
922 switch (d->containsMode) {
924 return QQuickItem::contains(point);
925 case FillContains:
926 for (QQuickShapePath *path : d->sp) {
927 if (path->path().contains(point))
928 return true;
929 }
930 }
931 return false;
932}
933
935{
936 QQuickShape *item = static_cast<QQuickShape *>(property->object);
938 QQuickShapePath *path = qobject_cast<QQuickShapePath *>(obj);
939 if (path)
940 d->sp.append(path);
941
943
944 if (path && d->componentComplete) {
945 QObject::connect(path, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
946 d->_q_shapePathChanged();
947 }
948}
949
951{
952 QQuickShape *item = static_cast<QQuickShape *>(property->object);
954
955 for (QQuickShapePath *p : d->sp)
956 QObject::disconnect(p, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
957
958 d->sp.clear();
959
961
962 if (d->componentComplete)
963 d->_q_shapePathChanged();
964}
965
977{
978 return QQmlListProperty<QObject>(this,
979 nullptr,
983 vpe_clear);
984}
985
987{
989}
990
992{
993 Q_D(QQuickShape);
994
996
997 for (QQuickShapePath *p : d->sp)
998 connect(p, SIGNAL(shapePathChanged()), this, SLOT(_q_shapePathChanged()));
999
1000 d->_q_shapePathChanged();
1001}
1002
1004{
1005 Q_D(QQuickShape);
1006
1007 const int currentEffectRefCount = d->extra.isAllocated() ? d->extra->recursiveEffectRefCount : 0;
1008 if (!d->spChanged && currentEffectRefCount <= d->effectRefCount)
1009 return;
1010
1011 d->spChanged = false;
1012 d->effectRefCount = currentEffectRefCount;
1013
1014 QQuickShape::RendererType expectedRenderer = d->selectRendererType();
1015 if (d->rendererType != expectedRenderer) {
1016 delete d->renderer;
1017 d->renderer = nullptr;
1018 }
1019
1020 if (!d->renderer) {
1021 d->createRenderer();
1022 if (!d->renderer)
1023 return;
1025 }
1026
1027 // endSync() is where expensive calculations may happen (or get kicked off
1028 // on worker threads), depending on the backend. Therefore do this only
1029 // when the item is visible.
1030 if (isVisible() || d->effectRefCount > 0)
1031 d->sync();
1032}
1033
1035{
1036 Q_D(QQuickShape);
1037
1038 // sync may have been deferred; do it now if the item became visible
1039 if (change == ItemVisibleHasChanged && data.boolValue)
1040 d->_q_shapePathChanged();
1041 else if (change == QQuickItem::ItemSceneChange) {
1042 for (int i = 0; i < d->sp.size(); ++i)
1044 d->_q_shapePathChanged();
1045 }
1046
1048}
1049
1051{
1052 // Called on the render thread, with the gui thread blocked. We can now
1053 // safely access gui thread data.
1054 Q_D(QQuickShape);
1055
1056 if (d->renderer || d->rendererChanged) {
1057 if (!node || d->rendererChanged) {
1058 d->rendererChanged = false;
1059 delete node;
1060 node = d->createNode();
1061 }
1062 if (d->renderer)
1063 d->renderer->updateNode();
1064 }
1065 return node;
1066}
1067
1069{
1071 Q_Q(QQuickShape);
1072 QSGRendererInterface *ri = q->window()->rendererInterface();
1073 if (!ri)
1074 return res;
1075
1076 static const bool environmentPreferCurve =
1077 qEnvironmentVariable("QT_QUICKSHAPES_BACKEND").toLower() == QLatin1String("curve");
1078
1079 switch (ri->graphicsApi()) {
1082 break;
1083 default:
1085 if (preferredType == QQuickShape::CurveRenderer || environmentPreferCurve) {
1087 } else {
1089 }
1090 } else {
1091 qWarning("No path backend for this graphics API yet");
1092 }
1093 break;
1094 }
1095
1096 return res;
1097}
1098
1099// the renderer object lives on the gui thread
1101{
1102 Q_Q(QQuickShape);
1104 if (selectedType == QQuickShape::UnknownRenderer)
1105 return;
1106
1107 rendererType = selectedType;
1108 rendererChanged = true;
1109
1110 switch (selectedType) {
1113 break;
1116 break;
1119 break;
1120 default:
1121 Q_UNREACHABLE();
1122 break;
1123 }
1124}
1125
1126// the node lives on the render thread
1128{
1129 Q_Q(QQuickShape);
1130 QSGNode *node = nullptr;
1131 if (!q->window() || !renderer)
1132 return node;
1133 QSGRendererInterface *ri = q->window()->rendererInterface();
1134 if (!ri)
1135 return node;
1136
1137 switch (ri->graphicsApi()) {
1139 node = new QQuickShapeSoftwareRenderNode(q);
1140 static_cast<QQuickShapeSoftwareRenderer *>(renderer)->setNode(
1141 static_cast<QQuickShapeSoftwareRenderNode *>(node));
1142 break;
1143 default:
1146 node = new QSGNode;
1147 static_cast<QQuickShapeCurveRenderer *>(renderer)->setRootNode(node);
1148 } else {
1149 node = new QQuickShapeGenericNode;
1150 static_cast<QQuickShapeGenericRenderer *>(renderer)->setRootNode(
1151 static_cast<QQuickShapeGenericNode *>(node));
1152 }
1153 } else {
1154 qWarning("No path backend for this graphics API yet");
1155 }
1156 break;
1157 }
1158
1159 return node;
1160}
1161
1163{
1164 QQuickShapePrivate *self = static_cast<QQuickShapePrivate *>(data);
1165 self->setStatus(QQuickShape::Ready);
1166 if (self->syncTimingActive)
1167 qDebug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms",
1168 self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed());
1169}
1170
1172{
1173 int totalDirty = 0;
1174 syncTimingActive = QQSHAPE_LOG_TIME_DIRTY_SYNC().isDebugEnabled();
1175 if (syncTimingActive)
1176 syncTimer.start();
1177
1178 const bool useAsync = async && renderer->flags().testFlag(QQuickAbstractPathRenderer::SupportsAsync);
1179 if (useAsync) {
1182 }
1183
1184 const int count = sp.size();
1185 bool countChanged = false;
1186 renderer->beginSync(count, &countChanged);
1188
1189 for (int i = 0; i < count; ++i) {
1190 QQuickShapePath *p = sp[i];
1192 totalDirty |= dirty;
1193
1195 renderer->setPath(i, p);
1197 renderer->setStrokeColor(i, p->strokeColor());
1199 renderer->setStrokeWidth(i, p->strokeWidth());
1201 renderer->setFillColor(i, p->fillColor());
1203 renderer->setFillRule(i, p->fillRule());
1205 renderer->setJoinStyle(i, p->joinStyle(), p->miterLimit());
1206 renderer->setCapStyle(i, p->capStyle());
1207 }
1209 renderer->setStrokeStyle(i, p->strokeStyle(), p->dashOffset(), p->dashPattern());
1211 renderer->setFillGradient(i, p->fillGradient());
1212
1213 dirty = 0;
1214 }
1215
1216 syncTimingTotalDirty = totalDirty;
1219 else
1220 syncTimingActive = false;
1221
1222 renderer->endSync(useAsync);
1223
1224 if (!useAsync) {
1226 if (syncTimingActive)
1227 qDebug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms",
1229 }
1230
1231 // Must dirty the QQuickItem if something got changed, nothing
1232 // else does this for us.
1233 Q_Q(QQuickShape);
1234 if (totalDirty || countChanged)
1235 q->update();
1236}
1237
1238// ***** gradient support *****
1239
1243
1257 m_spread(PadSpread)
1258{
1259}
1260
1278{
1279 return m_spread;
1280}
1281
1283{
1284 if (m_spread != mode) {
1285 m_spread = mode;
1287 emit updated();
1288 }
1289}
1290
1294
1313{
1314}
1315
1327{
1328 return m_start.x();
1329}
1330
1332{
1333 if (m_start.x() != v) {
1334 m_start.setX(v);
1335 emit x1Changed();
1336 emit updated();
1337 }
1338}
1339
1341{
1342 return m_start.y();
1343}
1344
1346{
1347 if (m_start.y() != v) {
1348 m_start.setY(v);
1349 emit y1Changed();
1350 emit updated();
1351 }
1352}
1353
1355{
1356 return m_end.x();
1357}
1358
1360{
1361 if (m_end.x() != v) {
1362 m_end.setX(v);
1363 emit x2Changed();
1364 emit updated();
1365 }
1366}
1367
1369{
1370 return m_end.y();
1371}
1372
1374{
1375 if (m_end.y() != v) {
1376 m_end.setY(v);
1377 emit y2Changed();
1378 emit updated();
1379 }
1380}
1381
1385
1429{
1430}
1431
1444{
1445 return m_centerPoint.x();
1446}
1447
1449{
1450 if (m_centerPoint.x() != v) {
1451 m_centerPoint.setX(v);
1453 emit updated();
1454 }
1455}
1456
1458{
1459 return m_centerPoint.y();
1460}
1461
1463{
1464 if (m_centerPoint.y() != v) {
1465 m_centerPoint.setY(v);
1467 emit updated();
1468 }
1469}
1470
1480{
1481 return m_centerRadius;
1482}
1483
1485{
1486 if (m_centerRadius != v) {
1487 m_centerRadius = v;
1489 emit updated();
1490 }
1491}
1492
1494{
1495 return m_focalPoint.x();
1496}
1497
1499{
1500 if (m_focalPoint.x() != v) {
1501 m_focalPoint.setX(v);
1503 emit updated();
1504 }
1505}
1506
1508{
1509 return m_focalPoint.y();
1510}
1511
1513{
1514 if (m_focalPoint.y() != v) {
1515 m_focalPoint.setY(v);
1517 emit updated();
1518 }
1519}
1520
1522{
1523 return m_focalRadius;
1524}
1525
1527{
1528 if (m_focalRadius != v) {
1529 m_focalRadius = v;
1531 emit updated();
1532 }
1533}
1534
1538
1559{
1560}
1561
1570{
1571 return m_centerPoint.x();
1572}
1573
1575{
1576 if (m_centerPoint.x() != v) {
1577 m_centerPoint.setX(v);
1579 emit updated();
1580 }
1581}
1582
1584{
1585 return m_centerPoint.y();
1586}
1587
1589{
1590 if (m_centerPoint.y() != v) {
1591 m_centerPoint.setY(v);
1593 emit updated();
1594 }
1595}
1596
1605{
1606 return m_angle;
1607}
1608
1610{
1611 if (m_angle != v) {
1612 m_angle = v;
1614 emit updated();
1615 }
1616}
1617
1619 uint *colorTable, int size, float opacity)
1620{
1621 int pos = 0;
1622 const QGradientStops &s = gradient.stops;
1623 Q_ASSERT(!s.isEmpty());
1624 const bool colorInterpolation = true;
1625
1626 uint alpha = qRound(opacity * 256);
1627 uint current_color = ARGB_COMBINE_ALPHA(s[0].second.rgba(), alpha);
1628 qreal incr = 1.0 / qreal(size);
1629 qreal fpos = 1.5 * incr;
1630 colorTable[pos++] = ARGB2RGBA(qPremultiply(current_color));
1631
1632 while (fpos <= s.first().first) {
1633 colorTable[pos] = colorTable[pos - 1];
1634 pos++;
1635 fpos += incr;
1636 }
1637
1638 if (colorInterpolation)
1639 current_color = qPremultiply(current_color);
1640
1641 const int sLast = s.size() - 1;
1642 for (int i = 0; i < sLast; ++i) {
1643 qreal delta = 1/(s[i+1].first - s[i].first);
1644 uint next_color = ARGB_COMBINE_ALPHA(s[i + 1].second.rgba(), alpha);
1645 if (colorInterpolation)
1646 next_color = qPremultiply(next_color);
1647
1648 while (fpos < s[i+1].first && pos < size) {
1649 int dist = int(256 * ((fpos - s[i].first) * delta));
1650 int idist = 256 - dist;
1651 if (colorInterpolation)
1652 colorTable[pos] = ARGB2RGBA(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist));
1653 else
1654 colorTable[pos] = ARGB2RGBA(qPremultiply(INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist)));
1655 ++pos;
1656 fpos += incr;
1657 }
1658 current_color = next_color;
1659 }
1660
1661 uint last_color = ARGB2RGBA(qPremultiply(ARGB_COMBINE_ALPHA(s[sLast].second.rgba(), alpha)));
1662 for ( ; pos < size; ++pos)
1663 colorTable[pos] = last_color;
1664
1665 colorTable[size-1] = last_color;
1666}
1667
1669{
1670 qDeleteAll(m_textures);
1671}
1672
1674{
1676 auto it = caches.constFind(rhi);
1677 if (it != caches.constEnd())
1678 return *it;
1679
1681 rhi->addCleanupCallback([cache](QRhi *rhi) {
1682 caches.remove(rhi);
1683 delete cache;
1684 });
1685 caches.insert(rhi, cache);
1686 return cache;
1687}
1688
1690{
1691 QSGPlainTexture *tx = m_textures[grad];
1692 if (!tx) {
1693 static const int W = 1024; // texture size is 1024x1
1695 if (!grad.stops.isEmpty())
1696 generateGradientColorTable(grad, reinterpret_cast<uint *>(gradTab.bits()), W, 1.0f);
1697 else
1698 gradTab.fill(Qt::black);
1699 tx = new QSGPlainTexture;
1700 tx->setImage(gradTab);
1701 switch (grad.spread) {
1705 break;
1709 break;
1713 break;
1714 default:
1715 qWarning("Unknown gradient spread mode %d", grad.spread);
1716 break;
1717 }
1719 m_textures[grad] = tx;
1720 }
1721 return tx;
1722}
1723
1725
1726#include "moc_qquickshape_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
Starts this timer.
\inmodule QtCore
Definition qhash.h:818
\inmodule QtGui
Definition qimage.h:37
uchar * bits()
Returns a pointer to the first pixel data.
Definition qimage.cpp:1677
@ Format_RGBA8888_Premultiplied
Definition qimage.h:60
void fill(uint pixel)
Fills the entire image with the given pixelValue.
Definition qimage.cpp:1738
Definition qlist.h:74
bool isEmpty() const noexcept
Definition qlist.h:390
\inmodule QtCore
Definition qobject.h:90
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3099
\inmodule QtCore\reentrant
Definition qpoint.h:214
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:333
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:338
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
Definition qpoint.h:348
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
Definition qpoint.h:343
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
virtual void setPath(int index, const QQuickPath *path)=0
virtual void setTriangulationScale(qreal)
virtual void beginSync(int totalCount, bool *countChanged)=0
virtual void setStrokeColor(int index, const QColor &color)=0
virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern)=0
virtual void setAsyncCallback(void(*)(void *), void *)
virtual Flags flags() const
virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle)=0
virtual void setFillGradient(int index, QQuickShapeGradient *gradient)=0
virtual void setFillColor(int index, const QColor &color)=0
virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule)=0
virtual void setStrokeWidth(int index, qreal w)=0
virtual void endSync(bool async)=0
virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
static void data_clear(QQmlListProperty< QObject > *)
static qsizetype data_count(QQmlListProperty< QObject > *)
\qmlproperty list<QtObject> QtQuick::Item::data \qmldefault
static QObject * data_at(QQmlListProperty< QObject > *, qsizetype)
void dirty(DirtyType)
QQmlListProperty< QObject > data()
static void data_append(QQmlListProperty< QObject > *, QObject *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
bool isVisible() const
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:143
@ ItemVisibleHasChanged
Definition qquickitem.h:147
void update()
Schedules a call to updatePaintNode() for this item.
void polish()
Schedules a polish event for this item.
void changed()
QQuickShapeConicalGradient(QObject *parent=nullptr)
Conical gradient.
QSGTexture * get(const QQuickShapeGradientCacheKey &grad)
static QQuickShapeGradientCache * cacheForRhi(QRhi *rhi)
QQuickShapeGradient(QObject *parent=nullptr)
Base type of Shape fill gradients.
void setSpread(SpreadMode mode)
QQuickShapeLinearGradient(QObject *parent=nullptr)
Linear gradient.
static QQuickShapePathPrivate * get(QQuickShapePath *p)
QQuickShapePathPrivate()
Describes a Path and associated properties for stroking and filling.
void joinStyleChanged()
void setDashPattern(const QVector< qreal > &array)
void setJoinStyle(JoinStyle style)
void setFillGradient(QQuickShapeGradient *gradient)
void strokeColorChanged()
void setStrokeColor(const QColor &color)
void setFillRule(FillRule fillRule)
void setMiterLimit(int limit)
StrokeStyle strokeStyle
JoinStyle joinStyle
void setStrokeWidth(qreal w)
void dashPatternChanged()
void setDashOffset(qreal offset)
void strokeWidthChanged()
QQuickShapePath(QObject *parent=nullptr)
void strokeStyleChanged()
void fillRuleChanged()
void fillColorChanged()
void setCapStyle(CapStyle style)
void capStyleChanged()
QVector< qreal > dashPattern
void dashOffsetChanged()
void shapePathChanged()
void setStrokeStyle(StrokeStyle style)
void miterLimitChanged()
QQuickShapeGradient * fillGradient
void setFillColor(const QColor &color)
QQuickShape::RendererType rendererType
QVector< QQuickShapePath * > sp
QQuickShapePrivate()
Renders a path.
static QQuickShapePrivate * get(QQuickShape *item)
void setStatus(QQuickShape::Status newStatus)
QElapsedTimer syncTimer
QQuickShape::Status status
QQuickAbstractPathRenderer * renderer
QQuickShape::RendererType preferredType
static void asyncShapeReady(void *data)
QQuickShape::RendererType selectRendererType()
QQuickShapeRadialGradient(QObject *parent=nullptr)
Radial gradient.
RendererType preferredRendererType
\qmlproperty enumeration QtQuick.Shapes::Shape::preferredRendererType
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
QSGNode * updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void vendorExtensionsEnabledChanged()
FINALStatus status
void asynchronousChanged()
void rendererChanged()
bool contains(const QPointF &point) const override
\qmlmethod bool QtQuick::Item::contains(point point)
bool vendorExtensionsEnabled
RendererType rendererType
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setContainsMode(ContainsMode containsMode)
void setAsynchronous(bool async)
QQuickShape(QQuickItem *parent=nullptr)
void setVendorExtensionsEnabled(bool enable)
void updatePolish() override
This function should perform any layout as required for this item.
FINALQRectF boundingRect
\qmlproperty rect QtQuick.Shapes::Shape::boundingRect
ContainsMode containsMode
FINALQQmlListProperty< QObject > data
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
static void defineModule()
\inmodule QtCore\reentrant
Definition qrect.h:483
QRectF united(const QRectF &other) const noexcept
Definition qrect.h:838
\inmodule QtGui
Definition qrhi.h:1767
void addCleanupCallback(const CleanupCallback &callback)
Registers a callback that is invoked either when the QRhi is destroyed, or when runCleanup() is calle...
Definition qrhi.cpp:8445
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
void setImage(const QImage &image)
An interface providing access to some of the graphics API specific internals of the scenegraph.
static bool isApiRhiBased(GraphicsApi api)
virtual GraphicsApi graphicsApi() const =0
Returns the graphics API that is in use by the Qt Quick scenegraph.
\inmodule QtQuick
Definition qsgtexture.h:20
void setHorizontalWrapMode(WrapMode hwrap)
Sets the horizontal wrap mode to hwrap.
void setFiltering(Filtering filter)
Sets the sampling mode to filter.
void setVerticalWrapMode(WrapMode vwrap)
Sets the vertical wrap mode to vwrap.
QString toLower() const &
Definition qstring.h:368
qDeleteAll(list.begin(), list.end())
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ black
Definition qnamespace.h:29
Q_CONSTRUCTOR_FUNCTION(initializeStandardUserDefaults)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define ARGB_COMBINE_ALPHA(argb, alpha)
static uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b)
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:281
#define qDebug
[1]
Definition qlogging.h:160
#define qWarning
Definition qlogging.h:162
#define Q_LOGGING_CATEGORY(name,...)
#define SLOT(a)
Definition qobjectdefs.h:51
#define SIGNAL(a)
Definition qobjectdefs.h:52
GLsizei const GLfloat * v
[13]
GLenum mode
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLboolean enable
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint first
GLhandleARB obj
[2]
GLuint res
GLenum array
GLint limit
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei const GLchar *const * path
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
GLfloat GLfloat GLfloat alpha
Definition qopenglext.h:418
static quint32 ARGB2RGBA(quint32 x)
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
static void generateGradientColorTable(const QQuickShapeGradientCacheKey &gradient, uint *colorTable, int size, float opacity)
static void initResources()
static void vpe_clear(QQmlListProperty< QObject > *property)
static void vpe_append(QQmlListProperty< QObject > *property, QObject *obj)
QT_BEGIN_NAMESPACE void QQuickShapes_initializeModule()
\qmlmodule QtQuick.Shapes 1.
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
constexpr QRgb qPremultiply(QRgb x)
Definition qrgb.h:45
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define sp
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
#define emit
#define Q_INIT_RESOURCE(name)
Definition qtresource.h:14
unsigned int uint
Definition qtypes.h:29
double qreal
Definition qtypes.h:92
const char property[13]
Definition qwizard.cpp:101
std::uniform_real_distribution dist(1, 2.5)
[2]
QObject::connect nullptr
QGraphicsItem * item
QQuickShapeGradient::SpreadMode spread
QThreadStorage< QCache< QString, SomeClass > > caches
[7]
Definition threads.cpp:43
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
\inmodule QtQuick
Definition qquickitem.h:158