Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
73
75
76void QQuickShapesModule::defineModule()
77{
79}
80
82 : strokeColor(Qt::white),
83 strokeWidth(1),
84 fillColor(Qt::white),
85 fillRule(QQuickShapePath::OddEvenFill),
86 joinStyle(QQuickShapePath::BevelJoin),
87 miterLimit(2),
88 capStyle(QQuickShapePath::SquareCap),
89 strokeStyle(QQuickShapePath::SolidLine),
90 dashOffset(0),
91 fillGradient(nullptr)
92{
93 dashPattern << 4 << 2; // 4 * strokeWidth dash followed by 2 * strokeWidth space
94}
95
99
156 : dirty(DirtyAll)
157{
158 // Set this QQuickPath to be a ShapePath
159 isShapePath = true;
160}
161
163 : QQuickPath(*(new QQuickShapePathPrivate), parent)
164{
165 // The inherited changed() and the shapePathChanged() signals remain
166 // distinct, and this is intentional. Combining the two is not possible due
167 // to the difference in semantics and the need to act (see dirty flag
168 // below) differently on QQuickPath-related changes.
169
170 connect(this, &QQuickPath::changed, [this]() {
171 Q_D(QQuickShapePath);
174 });
175}
176
180
192{
193 Q_D(const QQuickShapePath);
194 return d->sfp.strokeColor;
195}
196
198{
199 Q_D(QQuickShapePath);
200 if (d->sfp.strokeColor != color) {
201 d->sfp.strokeColor = color;
205 }
206}
207
219{
220 Q_D(const QQuickShapePath);
221 return d->sfp.strokeWidth;
222}
223
225{
226 Q_D(QQuickShapePath);
227 if (d->sfp.strokeWidth != w) {
228 d->sfp.strokeWidth = w;
232 }
233}
234
246{
247 Q_D(const QQuickShapePath);
248 return d->sfp.fillColor;
249}
250
252{
253 Q_D(QQuickShapePath);
254 if (d->sfp.fillColor != color) {
255 d->sfp.fillColor = color;
259 }
260}
261
277{
278 Q_D(const QQuickShapePath);
279 return d->sfp.fillRule;
280}
281
283{
284 Q_D(QQuickShapePath);
285 if (d->sfp.fillRule != fillRule) {
286 d->sfp.fillRule = fillRule;
290 }
291}
292
311{
312 Q_D(const QQuickShapePath);
313 return d->sfp.joinStyle;
314}
315
317{
318 Q_D(QQuickShapePath);
319 if (d->sfp.joinStyle != style) {
320 d->sfp.joinStyle = style;
324 }
325}
326
337{
338 Q_D(const QQuickShapePath);
339 return d->sfp.miterLimit;
340}
341
343{
344 Q_D(QQuickShapePath);
345 if (d->sfp.miterLimit != limit) {
346 d->sfp.miterLimit = limit;
350 }
351}
352
371{
372 Q_D(const QQuickShapePath);
373 return d->sfp.capStyle;
374}
375
377{
378 Q_D(QQuickShapePath);
379 if (d->sfp.capStyle != style) {
380 d->sfp.capStyle = style;
384 }
385}
386
398{
399 Q_D(const QQuickShapePath);
400 return d->sfp.strokeStyle;
401}
402
404{
405 Q_D(QQuickShapePath);
406 if (d->sfp.strokeStyle != style) {
407 d->sfp.strokeStyle = style;
411 }
412}
413
426{
427 Q_D(const QQuickShapePath);
428 return d->sfp.dashOffset;
429}
430
432{
433 Q_D(QQuickShapePath);
434 if (d->sfp.dashOffset != offset) {
435 d->sfp.dashOffset = offset;
439 }
440}
441
456QVector<qreal> QQuickShapePath::dashPattern() const
457{
458 Q_D(const QQuickShapePath);
459 return d->sfp.dashPattern;
460}
461
462void QQuickShapePath::setDashPattern(const QVector<qreal> &array)
463{
464 Q_D(QQuickShapePath);
465 if (d->sfp.dashPattern != array) {
466 d->sfp.dashPattern = array;
470 }
471}
472
488{
489 Q_D(const QQuickShapePath);
490 return d->sfp.fillGradient;
491}
492
494{
495 Q_D(QQuickShapePath);
496 if (d->sfp.fillGradient != gradient) {
497 if (d->sfp.fillGradient)
498 qmlobject_disconnect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
499 this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
500 d->sfp.fillGradient = gradient;
501 if (d->sfp.fillGradient)
502 qmlobject_connect(d->sfp.fillGradient, QQuickShapeGradient, SIGNAL(updated()),
503 this, QQuickShapePath, SLOT(_q_fillGradientChanged()));
506 }
507}
508
510{
511 Q_Q(QQuickShapePath);
513 emit q->shapePathChanged();
514}
515
520
557QQuickShapePath::PathHints QQuickShapePath::pathHints() const
558{
559 Q_D(const QQuickShapePath);
560 return d->pathHints;
561}
562
563void QQuickShapePath::setPathHints(PathHints newPathHints)
564{
565 Q_D(QQuickShapePath);
566 if (d->pathHints == newPathHints)
567 return;
568 d->pathHints = newPathHints;
569 emit pathHintsChanged();
570}
571
582{
583 Q_D(const QQuickShapePath);
584 return d->sfp.fillTransform.matrix();
585}
586
588{
589 Q_D(QQuickShapePath);
590 if (d->sfp.fillTransform != matrix) {
591 d->sfp.fillTransform.setMatrix(matrix);
593 emit fillTransformChanged();
595 }
596}
597
601
710 : effectRefCount(0)
711{
712}
713
718
720{
721 Q_Q(QQuickShape);
722 spChanged = true;
723 q->polish();
724 emit q->boundingRectChanged();
725 auto br = q->boundingRect();
726 q->setImplicitSize(br.right(), br.bottom());
727}
728
730{
731 Q_Q(QQuickShape);
732 if (status != newStatus) {
733 status = newStatus;
734 emit q->statusChanged();
735 }
736}
737
739{
740 Q_Q(const QQuickShape);
741 return q->boundingRect().right();
742}
743
745{
746 Q_Q(const QQuickShape);
747 return q->boundingRect().bottom();
748}
749
755
759
800{
801 Q_D(const QQuickShape);
802 return d->rendererType;
803}
804
824{
825 Q_D(const QQuickShape);
826 return d->preferredType;
827}
828
829void QQuickShape::setPreferredRendererType(QQuickShape::RendererType preferredType)
830{
831 Q_D(QQuickShape);
832 if (d->preferredType == preferredType)
833 return;
834
835 d->preferredType = preferredType;
836 // (could bail out here if selectRenderType shows no change?)
837
838 for (int i = 0; i < d->sp.size(); ++i) {
839 QQuickShapePath *p = d->sp[i];
842 }
843 d->spChanged = true;
844 d->_q_shapePathChanged();
845 polish();
846 update();
847
848 emit preferredRendererTypeChanged();
849}
850
868{
869 Q_D(const QQuickShape);
870 return d->async;
871}
872
874{
875 Q_D(QQuickShape);
876 if (d->async != async) {
877 d->async = async;
879 if (d->componentComplete)
880 d->_q_shapePathChanged();
881 }
882}
883
892{
893 Q_D(const QQuickShape);
894 QRectF brect;
895 for (QQuickShapePath *path : d->sp) {
896 qreal pw = path->strokeColor().alpha() ? path->strokeWidth() : 0;
897 qreal d = path->capStyle() == QQuickShapePath::SquareCap ? pw * M_SQRT1_2 : pw / 2;
898 brect = brect.united(path->path().boundingRect().adjusted(-d, -d, d, d));
899 }
900
901 return brect;
902}
903
915{
916 Q_D(const QQuickShape);
917 return d->enableVendorExts;
918}
919
921{
922 Q_D(QQuickShape);
923 if (d->enableVendorExts != enable) {
924 d->enableVendorExts = enable;
926 }
927}
928
947{
948 Q_D(const QQuickShape);
949 return d->status;
950}
951
978{
979 Q_D(const QQuickShape);
980 return d->containsMode;
981}
982
984{
985 Q_D(QQuickShape);
986 if (d->containsMode == containsMode)
987 return;
988
989 d->containsMode = containsMode;
990 emit containsModeChanged();
991}
992
993bool QQuickShape::contains(const QPointF &point) const
994{
995 Q_D(const QQuickShape);
996 switch (d->containsMode) {
998 return QQuickItem::contains(point);
999 case FillContains:
1000 for (QQuickShapePath *path : d->sp) {
1001 if (path->path().contains(point))
1002 return true;
1003 }
1004 }
1005 return false;
1006}
1007
1024{
1025 Q_D(const QQuickShape);
1026 return d->fillMode;
1027}
1028
1029void QQuickShape::setFillMode(FillMode newFillMode)
1030{
1031 Q_D(QQuickShape);
1032 if (d->fillMode == newFillMode)
1033 return;
1034 d->fillMode = newFillMode;
1035 emit fillModeChanged();
1036}
1037
1053{
1054 Q_D(const QQuickShape);
1055 return d->horizontalAlignment;
1056}
1057
1058void QQuickShape::setHorizontalAlignment(HAlignment newHorizontalAlignment)
1059{
1060 Q_D(QQuickShape);
1061 if (d->horizontalAlignment == newHorizontalAlignment)
1062 return;
1063 d->horizontalAlignment = newHorizontalAlignment;
1064 emit horizontalAlignmentChanged();
1065}
1066
1068{
1069 Q_D(const QQuickShape);
1070 return d->verticalAlignment;
1071}
1072
1073void QQuickShape::setVerticalAlignment(VAlignment newVerticalAlignment)
1074{
1075 Q_D(QQuickShape);
1076 if (d->verticalAlignment == newVerticalAlignment)
1077 return;
1078 d->verticalAlignment = newVerticalAlignment;
1079 emit verticalAlignmentChanged();
1080}
1081
1082static void vpe_append(QQmlListProperty<QObject> *property, QObject *obj)
1083{
1084 QQuickShape *item = static_cast<QQuickShape *>(property->object);
1086 QQuickShapePath *path = qobject_cast<QQuickShapePath *>(obj);
1087 if (path)
1088 d->sp.append(path);
1089
1091
1092 if (path && d->componentComplete) {
1093 QObject::connect(path, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
1094 d->_q_shapePathChanged();
1095 }
1096}
1097
1098static void vpe_clear(QQmlListProperty<QObject> *property)
1099{
1100 QQuickShape *item = static_cast<QQuickShape *>(property->object);
1102
1103 for (QQuickShapePath *p : d->sp)
1104 QObject::disconnect(p, SIGNAL(shapePathChanged()), item, SLOT(_q_shapePathChanged()));
1105
1106 d->sp.clear();
1107
1109
1110 if (d->componentComplete)
1111 d->_q_shapePathChanged();
1112}
1113
1124QQmlListProperty<QObject> QQuickShape::data()
1125{
1126 return QQmlListProperty<QObject>(this,
1127 nullptr,
1128 vpe_append,
1131 vpe_clear);
1132}
1133
1138
1140{
1141 Q_D(QQuickShape);
1142
1144
1145 for (QQuickShapePath *p : d->sp)
1146 connect(p, SIGNAL(shapePathChanged()), this, SLOT(_q_shapePathChanged()));
1147
1148 d->_q_shapePathChanged();
1149}
1150
1152{
1153 Q_D(QQuickShape);
1154
1155 const int currentEffectRefCount = d->extra.isAllocated() ? d->extra->recursiveEffectRefCount : 0;
1156 if (!d->spChanged && currentEffectRefCount <= d->effectRefCount)
1157 return;
1158
1159 d->spChanged = false;
1160 d->effectRefCount = currentEffectRefCount;
1161
1162 QQuickShape::RendererType expectedRenderer = d->selectRendererType();
1163 if (d->rendererType != expectedRenderer) {
1164 delete d->renderer;
1165 d->renderer = nullptr;
1166 }
1167
1168 if (!d->renderer) {
1169 d->createRenderer();
1170 if (!d->renderer)
1171 return;
1173 }
1174
1175 // endSync() is where expensive calculations may happen (or get kicked off
1176 // on worker threads), depending on the backend. Therefore do this only
1177 // when the item is visible.
1178 if (isVisible() || d->effectRefCount > 0)
1179 d->sync();
1180}
1181
1183{
1184 Q_D(QQuickShape);
1185
1186 // sync may have been deferred; do it now if the item became visible
1187 if (change == ItemVisibleHasChanged && data.boolValue)
1188 d->_q_shapePathChanged();
1189 else if (change == QQuickItem::ItemSceneChange) {
1190 for (int i = 0; i < d->sp.size(); ++i)
1192 d->_q_shapePathChanged();
1193 }
1194
1196}
1197
1199{
1200 // Called on the render thread, with the gui thread blocked. We can now
1201 // safely access gui thread data.
1202 Q_D(QQuickShape);
1203
1204 if (d->renderer || d->rendererChanged) {
1205 if (!node || d->rendererChanged) {
1206 d->rendererChanged = false;
1207 delete node;
1208 node = d->createNode();
1209 }
1210 if (d->renderer)
1211 d->renderer->updateNode();
1212
1213 // TODO: only add transform node when needed (and then make sure static_cast is safe)
1214 QMatrix4x4 fillModeTransform;
1215 qreal xScale = 1.0;
1216 qreal yScale = 1.0;
1217
1218 if (d->fillMode != NoResize) {
1219 xScale = width() / implicitWidth();
1220 yScale = height() / implicitHeight();
1221
1222 if (d->fillMode == PreserveAspectFit)
1223 xScale = yScale = qMin(xScale, yScale);
1224 else if (d->fillMode == PreserveAspectCrop)
1225 xScale = yScale = qMax(xScale, yScale);
1226 fillModeTransform.scale(xScale, yScale);
1227 }
1228 if (d->horizontalAlignment != AlignLeft || d->verticalAlignment != AlignTop) {
1229 qreal tx = 0;
1230 qreal ty = 0;
1231 qreal w = xScale * implicitWidth();
1232 qreal h = yScale * implicitHeight();
1233 if (d->horizontalAlignment == AlignRight)
1234 tx = width() - w;
1235 else if (d->horizontalAlignment == AlignHCenter)
1236 tx = (width() - w) / 2;
1237 if (d->verticalAlignment == AlignBottom)
1238 ty = height() - h;
1239 else if (d->verticalAlignment == AlignVCenter)
1240 ty = (height() - h) / 2;
1241 fillModeTransform.translate(tx / xScale, ty / yScale);
1242 }
1243 static_cast<QSGTransformNode *>(node)->setMatrix(fillModeTransform);
1244 }
1245 return node;
1246}
1247
1249{
1251 Q_Q(QQuickShape);
1252 QSGRendererInterface *ri = q->window()->rendererInterface();
1253 if (!ri)
1254 return res;
1255
1256 static const bool environmentPreferCurve =
1257 qEnvironmentVariable("QT_QUICKSHAPES_BACKEND").toLower() == QLatin1String("curverenderer");
1258
1259 switch (ri->graphicsApi()) {
1262 break;
1263 default:
1264 if (QSGRendererInterface::isApiRhiBased(ri->graphicsApi())) {
1265 if (preferredType == QQuickShape::CurveRenderer || environmentPreferCurve) {
1267 } else {
1269 }
1270 } else {
1271 qWarning("No path backend for this graphics API yet");
1272 }
1273 break;
1274 }
1275
1276 return res;
1277}
1278
1279// the renderer object lives on the gui thread
1281{
1282 Q_Q(QQuickShape);
1284 if (selectedType == QQuickShape::UnknownRenderer)
1285 return;
1286
1287 rendererType = selectedType;
1288 rendererChanged = true;
1289
1290 switch (selectedType) {
1293 break;
1296 break;
1299 break;
1300 default:
1301 Q_UNREACHABLE();
1302 break;
1303 }
1304}
1305
1306// the node lives on the render thread
1308{
1309 Q_Q(QQuickShape);
1310 QSGNode *node = nullptr;
1311 if (!q->window() || !renderer)
1312 return node;
1313 QSGRendererInterface *ri = q->window()->rendererInterface();
1314 if (!ri)
1315 return node;
1316
1317 QSGNode *pathNode = nullptr;
1318 switch (ri->graphicsApi()) {
1320 pathNode = new QQuickShapeSoftwareRenderNode(q);
1321 static_cast<QQuickShapeSoftwareRenderer *>(renderer)->setNode(
1322 static_cast<QQuickShapeSoftwareRenderNode *>(pathNode));
1323 break;
1324 default:
1325 if (QSGRendererInterface::isApiRhiBased(ri->graphicsApi())) {
1327 pathNode = new QSGNode;
1328 static_cast<QQuickShapeCurveRenderer *>(renderer)->setRootNode(pathNode);
1329 } else {
1330 pathNode = new QQuickShapeGenericNode;
1331 static_cast<QQuickShapeGenericRenderer *>(renderer)->setRootNode(
1332 static_cast<QQuickShapeGenericNode *>(pathNode));
1333 }
1334 } else {
1335 qWarning("No path backend for this graphics API yet");
1336 }
1337 break;
1338 }
1339
1340 // TODO: only create transform node when needed
1341 node = new QSGTransformNode;
1342 node->appendChildNode(pathNode);
1343
1344 return node;
1345}
1346
1348{
1349 QQuickShapePrivate *self = static_cast<QQuickShapePrivate *>(data);
1350 self->setStatus(QQuickShape::Ready);
1351 if (self->syncTimingActive)
1352 qDebug("[Shape %p] [%d] [dirty=0x%x] async update took %lld ms",
1353 self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed());
1354}
1355
1357{
1358 int totalDirty = 0;
1359 syncTimingActive = QQSHAPE_LOG_TIME_DIRTY_SYNC().isDebugEnabled();
1360 if (syncTimingActive)
1361 syncTimer.start();
1362
1363 const bool useAsync = async && renderer->flags().testFlag(QQuickAbstractPathRenderer::SupportsAsync);
1364 if (useAsync) {
1367 }
1368
1369 const int count = sp.size();
1370 bool countChanged = false;
1371 renderer->beginSync(count, &countChanged);
1373
1374 for (int i = 0; i < count; ++i) {
1375 QQuickShapePath *p = sp[i];
1377 totalDirty |= dirty;
1378
1380 renderer->setPath(i, p);
1382 renderer->setStrokeColor(i, p->strokeColor());
1384 renderer->setStrokeWidth(i, p->strokeWidth());
1386 renderer->setFillColor(i, p->fillColor());
1388 renderer->setFillRule(i, p->fillRule());
1390 renderer->setJoinStyle(i, p->joinStyle(), p->miterLimit());
1391 renderer->setCapStyle(i, p->capStyle());
1392 }
1394 renderer->setStrokeStyle(i, p->strokeStyle(), p->dashOffset(), p->dashPattern());
1396 renderer->setFillGradient(i, p->fillGradient());
1399
1400 dirty = 0;
1401 }
1402
1403 syncTimingTotalDirty = totalDirty;
1406 else
1407 syncTimingActive = false;
1408
1409 renderer->endSync(useAsync);
1410
1411 if (!useAsync) {
1413 if (syncTimingActive)
1414 qDebug("[Shape %p] [%d] [dirty=0x%x] update took %lld ms",
1416 }
1417
1418 // Must dirty the QQuickItem if something got changed, nothing
1419 // else does this for us.
1420 Q_Q(QQuickShape);
1421 if (totalDirty || countChanged)
1422 q->update();
1423}
1424
1425// ***** gradient support *****
1426
1430
1443 : QQuickGradient(parent),
1444 m_spread(PadSpread)
1445{
1446}
1447
1465{
1466 return m_spread;
1467}
1468
1470{
1471 if (m_spread != mode) {
1472 m_spread = mode;
1474 emit updated();
1475 }
1476}
1477
1481
1502
1514{
1515 return m_start.x();
1516}
1517
1519{
1520 if (m_start.x() != v) {
1521 m_start.setX(v);
1522 emit x1Changed();
1523 emit updated();
1524 }
1525}
1526
1528{
1529 return m_start.y();
1530}
1531
1533{
1534 if (m_start.y() != v) {
1535 m_start.setY(v);
1536 emit y1Changed();
1537 emit updated();
1538 }
1539}
1540
1542{
1543 return m_end.x();
1544}
1545
1547{
1548 if (m_end.x() != v) {
1549 m_end.setX(v);
1550 emit x2Changed();
1551 emit updated();
1552 }
1553}
1554
1556{
1557 return m_end.y();
1558}
1559
1561{
1562 if (m_end.y() != v) {
1563 m_end.setY(v);
1564 emit y2Changed();
1565 emit updated();
1566 }
1567}
1568
1572
1618
1631{
1632 return m_centerPoint.x();
1633}
1634
1636{
1637 if (m_centerPoint.x() != v) {
1638 m_centerPoint.setX(v);
1640 emit updated();
1641 }
1642}
1643
1645{
1646 return m_centerPoint.y();
1647}
1648
1650{
1651 if (m_centerPoint.y() != v) {
1652 m_centerPoint.setY(v);
1654 emit updated();
1655 }
1656}
1657
1667{
1668 return m_centerRadius;
1669}
1670
1672{
1673 if (m_centerRadius != v) {
1674 m_centerRadius = v;
1676 emit updated();
1677 }
1678}
1679
1681{
1682 return m_focalPoint.x();
1683}
1684
1686{
1687 if (m_focalPoint.x() != v) {
1688 m_focalPoint.setX(v);
1690 emit updated();
1691 }
1692}
1693
1695{
1696 return m_focalPoint.y();
1697}
1698
1700{
1701 if (m_focalPoint.y() != v) {
1702 m_focalPoint.setY(v);
1704 emit updated();
1705 }
1706}
1707
1709{
1710 return m_focalRadius;
1711}
1712
1714{
1715 if (m_focalRadius != v) {
1716 m_focalRadius = v;
1718 emit updated();
1719 }
1720}
1721
1725
1748
1757{
1758 return m_centerPoint.x();
1759}
1760
1762{
1763 if (m_centerPoint.x() != v) {
1764 m_centerPoint.setX(v);
1766 emit updated();
1767 }
1768}
1769
1771{
1772 return m_centerPoint.y();
1773}
1774
1776{
1777 if (m_centerPoint.y() != v) {
1778 m_centerPoint.setY(v);
1780 emit updated();
1781 }
1782}
1783
1792{
1793 return m_angle;
1794}
1795
1797{
1798 if (m_angle != v) {
1799 m_angle = v;
1801 emit updated();
1802 }
1803}
1804
1806
1807#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
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
Definition qobject.cpp:3236
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
Definition qpoint.h:358
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
Definition qpoint.h:353
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 setFillTransform(int index, const QSGTransform &transform)=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:63
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...
qreal implicitWidth
Definition qquickitem.h:114
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)
qreal width
This property holds the width of this item.
Definition qquickitem.h:75
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
qreal implicitHeight
Definition qquickitem.h:115
qreal height
This property holds the height of this item.
Definition qquickitem.h:76
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
@ ItemVisibleHasChanged
Definition qquickitem.h:148
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.
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)
PathHints pathHints
void setFillRule(FillRule fillRule)
void setMiterLimit(int limit)
StrokeStyle strokeStyle
JoinStyle joinStyle
void setStrokeWidth(qreal w)
void setPathHints(PathHints newPathHints)
void dashPatternChanged()
void setDashOffset(qreal offset)
void setFillTransform(const QMatrix4x4 &matrix)
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)
FINALQMatrix4x4 fillTransform
void miterLimitChanged()
QQuickShapeGradient * fillGradient
void setFillColor(const QColor &color)
QQuickShape::RendererType rendererType
QVector< QQuickShapePath * > sp
QQuickShapePrivate()
Renders a path.
static QQuickShapePrivate * get(QQuickShape *item)
qreal getImplicitWidth() const override
void setStatus(QQuickShape::Status newStatus)
QElapsedTimer syncTimer
qreal getImplicitHeight() const override
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()
FINALFillMode fillMode
\qmlproperty enumeration QtQuick.Shapes::Shape::fillMode
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)
FINALVAlignment verticalAlignment
void setAsynchronous(bool async)
QQuickShape(QQuickItem *parent=nullptr)
void setVendorExtensionsEnabled(bool enable)
FINALHAlignment horizontalAlignment
\qmlproperty enumeration QtQuick.Shapes::Shape::horizontalAlignment \qmlproperty enumeration QtQuick....
void updatePolish() override
This function should perform any layout as required for this item.
QRectF boundingRect
\qmlproperty rect QtQuick.Shapes::Shape::boundingRect \readonly
ContainsMode containsMode
FINALQQmlListProperty< QObject > data
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
static void defineModule()
\inmodule QtCore\reentrant
Definition qrect.h:484
QRectF united(const QRectF &other) const noexcept
Definition qrect.h:852
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
Definition qsgnode.cpp:398
An interface providing access to some of the graphics API specific internals of the scenegraph.
static bool isApiRhiBased(GraphicsApi api)
The QSGTransformNode class implements transformations in the scene graph.
Definition qsgnode.h:241
QString toLower() const &
Definition qstring.h:435
Combined button and popup list for selecting options.
Definition qcompare.h:63
Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version)
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
static void setMatrix(libinput_device *dev)
#define qDebug
[1]
Definition qlogging.h:164
#define qWarning
Definition qlogging.h:166
#define Q_LOGGING_CATEGORY(name,...)
#define M_SQRT1_2
Definition qmath.h:237
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLsizei const GLfloat * v
[13]
GLenum mode
GLfloat GLfloat GLfloat w
[0]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint color
[2]
GLboolean enable
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLhandleARB obj
[2]
GLuint res
GLenum array
GLint limit
GLuint GLenum matrix
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
GLbyte ty
#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 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.
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
double qreal
Definition qtypes.h:187
const char property[13]
Definition qwizard.cpp:101
QObject::connect nullptr
QGraphicsItem * item
\inmodule QtQuick
Definition qquickitem.h:159