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
qsgnode.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 "qsgnode.h"
5#include "qsgnode_p.h"
6#include "qsgrenderer_p.h"
7#include "qsgnodeupdater_p.h"
8#include "qsgmaterial.h"
9
10#include "limits.h"
11
13
14#ifndef QT_NO_DEBUG
15static int qt_node_count = 0;
16
18{
19 qCDebug(lcQsgLeak, "Number of leaked nodes: %i", qt_node_count);
20 qt_node_count = -1;
21}
22#endif
23
210 : m_nodeFlags(OwnedByParent)
211{
212 init();
213}
214
221 : m_parent(nullptr)
222 , m_type(type)
223 , m_firstChild(nullptr)
224 , m_lastChild(nullptr)
225 , m_nextSibling(nullptr)
226 , m_previousSibling(nullptr)
227 , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
228 , m_nodeFlags(OwnedByParent)
229{
230 init();
231}
232
239 : m_parent(nullptr)
240 , m_type(type)
241 , m_firstChild(nullptr)
242 , m_lastChild(nullptr)
243 , m_nextSibling(nullptr)
244 , m_previousSibling(nullptr)
245 , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
246 , m_nodeFlags(OwnedByParent)
247 , d_ptr(&dd)
248{
249 init();
250}
251
255void QSGNode::init()
256{
257#ifndef QT_NO_DEBUG
258 if (lcQsgLeak().isDebugEnabled()) {
260 static bool atexit_registered = false;
261 if (!atexit_registered) {
262 atexit(qt_print_node_count);
263 atexit_registered = true;
264 }
265 }
266#endif
267
268#ifdef QSG_RUNTIME_DESCRIPTION
269 if (d_ptr.isNull())
271#endif
272}
273
281{
282#ifndef QT_NO_DEBUG
283 if (lcQsgLeak().isDebugEnabled()) {
285 if (qt_node_count < 0)
286 qCDebug(lcQsgLeak, "Node destroyed after qt_print_node_count() was called.");
287 }
288#endif
289 destroy();
290}
291
292
324{
325 return false;
326}
327
340void QSGNode::destroy()
341{
342 if (m_parent) {
343 m_parent->removeChildNode(this);
344 Q_ASSERT(m_parent == nullptr);
345 }
346 while (m_firstChild) {
347 QSGNode *child = m_firstChild;
349 Q_ASSERT(child->m_parent == nullptr);
350 if (child->flags() & OwnedByParent)
351 delete child;
352 }
353
354 Q_ASSERT(m_firstChild == nullptr && m_lastChild == nullptr);
355}
356
357
366{
367 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::prependChildNode", "QSGNode is already a child!");
368 Q_ASSERT_X(!node->m_parent, "QSGNode::prependChildNode", "QSGNode already has a parent");
369
370#ifndef QT_NO_DEBUG
371 if (node->type() == QSGNode::GeometryNodeType) {
372 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
373 Q_ASSERT_X(g->material(), "QSGNode::prependChildNode", "QSGGeometryNode is missing material");
374 Q_ASSERT_X(g->geometry(), "QSGNode::prependChildNode", "QSGGeometryNode is missing geometry");
375 }
376#endif
377
378 if (m_firstChild)
379 m_firstChild->m_previousSibling = node;
380 else
381 m_lastChild = node;
382 node->m_nextSibling = m_firstChild;
383 m_firstChild = node;
384 node->m_parent = this;
385
387}
388
397{
398 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::appendChildNode", "QSGNode is already a child!");
399 Q_ASSERT_X(!node->m_parent, "QSGNode::appendChildNode", "QSGNode already has a parent");
400
401#ifndef QT_NO_DEBUG
402 if (node->type() == QSGNode::GeometryNodeType) {
403 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
404 Q_ASSERT_X(g->material(), "QSGNode::appendChildNode", "QSGGeometryNode is missing material");
405 Q_ASSERT_X(g->geometry(), "QSGNode::appendChildNode", "QSGGeometryNode is missing geometry");
406 }
407#endif
408
409 if (m_lastChild)
410 m_lastChild->m_nextSibling = node;
411 else
412 m_firstChild = node;
413 node->m_previousSibling = m_lastChild;
414 m_lastChild = node;
415 node->m_parent = this;
416
418}
419
420
421
430{
431 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::insertChildNodeBefore", "QSGNode is already a child!");
432 Q_ASSERT_X(!node->m_parent, "QSGNode::insertChildNodeBefore", "QSGNode already has a parent");
433 Q_ASSERT_X(before && before->m_parent == this, "QSGNode::insertChildNodeBefore", "The parent of \'before\' is wrong");
434
435#ifndef QT_NO_DEBUG
436 if (node->type() == QSGNode::GeometryNodeType) {
437 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
438 Q_ASSERT_X(g->material(), "QSGNode::insertChildNodeBefore", "QSGGeometryNode is missing material");
439 Q_ASSERT_X(g->geometry(), "QSGNode::insertChildNodeBefore", "QSGGeometryNode is missing geometry");
440 }
441#endif
442
443 QSGNode *previous = before->m_previousSibling;
444 if (previous)
445 previous->m_nextSibling = node;
446 else
447 m_firstChild = node;
448 node->m_previousSibling = previous;
449 node->m_nextSibling = before;
450 before->m_previousSibling = node;
451 node->m_parent = this;
452
454}
455
456
457
466{
467 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::insertChildNodeAfter", "QSGNode is already a child!");
468 Q_ASSERT_X(!node->m_parent, "QSGNode::insertChildNodeAfter", "QSGNode already has a parent");
469 Q_ASSERT_X(after && after->m_parent == this, "QSGNode::insertChildNodeAfter", "The parent of \'after\' is wrong");
470
471#ifndef QT_NO_DEBUG
472 if (node->type() == QSGNode::GeometryNodeType) {
473 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
474 Q_ASSERT_X(g->material(), "QSGNode::insertChildNodeAfter", "QSGGeometryNode is missing material");
475 Q_ASSERT_X(g->geometry(), "QSGNode::insertChildNodeAfter", "QSGGeometryNode is missing geometry");
476 }
477#endif
478
479 QSGNode *next = after->m_nextSibling;
480 if (next)
481 next->m_previousSibling = node;
482 else
483 m_lastChild = node;
484 node->m_nextSibling = next;
485 node->m_previousSibling = after;
486 after->m_nextSibling = node;
487 node->m_parent = this;
488
490}
491
492
493
499{
500 //Q_ASSERT(m_children.contains(node));
501 Q_ASSERT(node->parent() == this);
502
503 QSGNode *previous = node->m_previousSibling;
504 QSGNode *next = node->m_nextSibling;
505 if (previous)
506 previous->m_nextSibling = next;
507 else
508 m_firstChild = next;
509 if (next)
510 next->m_previousSibling = previous;
511 else
512 m_lastChild = previous;
513 node->m_previousSibling = nullptr;
514 node->m_nextSibling = nullptr;
515
517 node->m_parent = nullptr;
518}
519
520
526{
527 while (m_firstChild) {
528 QSGNode *node = m_firstChild;
529 m_firstChild = node->m_nextSibling;
530 node->m_nextSibling = nullptr;
531 if (m_firstChild)
532 m_firstChild->m_previousSibling = nullptr;
533 else
534 m_lastChild = nullptr;
536 node->m_parent = nullptr;
537 }
538}
539
546{
547 for (QSGNode *c = firstChild(); c; c = firstChild()) {
549 newParent->appendChildNode(c);
550 }
551}
552
553
555{
556 int count = 0;
557 QSGNode *n = m_firstChild;
558 while (n) {
559 ++count;
560 n = n->m_nextSibling;
561 }
562 return count;
563}
564
565
567{
568 QSGNode *n = m_firstChild;
569 while (i && n) {
570 --i;
571 n = n->m_nextSibling;
572 }
573 return n;
574}
575
576
585{
586 if (bool(m_nodeFlags & f) == enabled)
587 return;
588 m_nodeFlags ^= f;
590 int changedFlag = f & UsePreprocess;
591 if (changedFlag)
592 markDirty(DirtyState(changedFlag));
593}
594
595
604{
605 Flags oldFlags = m_nodeFlags;
606 if (enabled)
607 m_nodeFlags |= f;
608 else
609 m_nodeFlags &= ~f;
611 int changedFlags = (oldFlags ^ m_nodeFlags) & UsePreprocess;
612 if (changedFlags)
613 markDirty(DirtyState(changedFlags));
614}
615
616
617
622void QSGNode::markDirty(DirtyState bits)
623{
624 int renderableCountDiff = 0;
625 if (bits & DirtyNodeAdded)
626 renderableCountDiff += m_subtreeRenderableCount;
628 renderableCountDiff -= m_subtreeRenderableCount;
629
630 QSGNode *p = m_parent;
631 while (p) {
632 p->m_subtreeRenderableCount += renderableCountDiff;
633 if (p->type() == RootNodeType)
634 static_cast<QSGRootNode *>(p)->notifyNodeChange(this, bits);
635 p = p->m_parent;
636 }
637}
638
639void qsgnode_set_description(QSGNode *node, const QString &description)
640{
641#ifdef QSG_RUNTIME_DESCRIPTION
642 QSGNodePrivate::setDescription(node, description);
643#else
644 Q_UNUSED(node);
645 Q_UNUSED(description);
646#endif
647}
648
669 : QSGNode(type)
670 , m_geometry(nullptr)
671 , m_matrix(nullptr)
672 , m_clip_list(nullptr)
673{
674}
675
676
681 : QSGNode(dd, type)
682 , m_geometry(nullptr)
683 , m_matrix(nullptr)
684 , m_clip_list(nullptr)
685{
686}
687
688
697{
698 if (flags() & OwnsGeometry)
699 delete m_geometry;
700}
701
702
763{
764 if ((flags() & OwnsGeometry) != 0 && m_geometry != geometry)
765 delete m_geometry;
766 m_geometry = geometry;
768}
769
770
771
825 : QSGBasicGeometryNode(GeometryNodeType)
826{
827}
828
829
834 : QSGBasicGeometryNode(dd, GeometryNodeType)
835 , m_render_order(0)
836 , m_material(nullptr)
837 , m_opaque_material(nullptr)
838 , m_opacity(1)
839{
840}
841
842
852{
853 if (flags() & OwnsMaterial)
854 delete m_material;
856 delete m_opaque_material;
857}
858
859
860
909{
910 m_render_order = order;
911}
912
913
914
926{
927 if ((flags() & OwnsMaterial) != 0 && m_material != material)
928 delete m_material;
929 m_material = material;
930#ifndef QT_NO_DEBUG
931 if (m_material != nullptr && m_opaque_material == m_material)
932 qWarning("QSGGeometryNode: using same material for both opaque and translucent");
933#endif
935}
936
937
938
957{
958 if ((flags() & OwnsOpaqueMaterial) != 0 && m_opaque_material != m_material)
959 delete m_opaque_material;
960 m_opaque_material = material;
961#ifndef QT_NO_DEBUG
962 if (m_opaque_material != nullptr && m_opaque_material == m_material)
963 qWarning("QSGGeometryNode: using same material for both opaque and translucent");
964#endif
965
967}
968
969
970
986{
987 if (m_opaque_material && m_opacity > 0.999)
988 return m_opaque_material;
989 return m_material;
990}
991
992
1003{
1004 Q_ASSERT(opacity >= 0 && opacity <= 1);
1005 m_opacity = opacity;
1006}
1007
1008
1038 : QSGBasicGeometryNode(ClipNodeType)
1039 , m_is_rectangular(false)
1040{
1041 Q_UNUSED(m_reserved);
1042}
1043
1044
1045
1056
1057
1058
1080{
1081 m_is_rectangular = rectHint;
1082}
1083
1084
1085
1100{
1101 m_clip_rect = rect;
1102}
1103
1104
1132 : QSGNode(TransformNodeType)
1133{
1134}
1135
1136
1137
1145
1146
1147
1161{
1162 m_matrix = matrix;
1164}
1165
1187{
1188 m_combined_matrix = matrix;
1189}
1190
1191
1192
1211 : QSGNode(RootNodeType)
1212{
1213}
1214
1215
1224{
1225 while (!m_renderers.isEmpty())
1226 m_renderers.constLast()->setRootNode(nullptr);
1227 destroy(); // Must call destroy() here because markDirty() casts this to QSGRootNode.
1228}
1229
1230
1231
1237void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state)
1238{
1239 for (int i=0; i<m_renderers.size(); ++i) {
1240 m_renderers.at(i)->nodeChanged(node, state);
1241 }
1242}
1243
1244
1245
1277 : QSGNode(OpacityNodeType)
1278{
1279}
1280
1281
1282
1290
1291
1292
1300
1311{
1312 opacity = qBound<qreal>(0, opacity, 1);
1313 if (m_opacity == opacity)
1314 return;
1315 DirtyState dirtyState = DirtyOpacity;
1316
1317 if ((m_opacity < OPACITY_THRESHOLD && opacity >= OPACITY_THRESHOLD) // blocked to unblocked
1318 || (m_opacity >= OPACITY_THRESHOLD && opacity < OPACITY_THRESHOLD)) // unblocked to blocked
1320
1321 m_opacity = opacity;
1323}
1324
1325
1326
1351{
1352 m_combined_opacity = opacity;
1353}
1354
1355
1356
1365{
1366 return m_opacity < OPACITY_THRESHOLD;
1367}
1368
1369
1381
1382
1384{
1385 switch (n->type()) {
1387 QSGTransformNode *t = static_cast<QSGTransformNode *>(n);
1391 break; }
1393 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(n);
1397 break; }
1398 case QSGNode::ClipNodeType: {
1399 QSGClipNode *c = static_cast<QSGClipNode *>(n);
1403 break; }
1405 QSGOpacityNode *o = static_cast<QSGOpacityNode *>(n);
1409 break; }
1410 default:
1412 break;
1413 }
1414}
1415
1417{
1418 for (QSGNode *c = n->firstChild(); c; c = c->nextSibling())
1419 visitNode(c);
1420}
1421
1422#ifndef QT_NO_DEBUG_STREAM
1424{
1425 if (!n) {
1426 d << "Geometry(null)";
1427 return d;
1428 }
1429 d << "GeometryNode(" << Qt::hex << (const void *) n << Qt::dec;
1430
1431 const QSGGeometry *g = n->geometry();
1432
1433 if (!g) {
1434 d << "no geometry";
1435 } else {
1436
1437 switch (g->drawingMode()) {
1438 case QSGGeometry::DrawTriangleStrip: d << "strip"; break;
1439 case QSGGeometry::DrawTriangleFan: d << "fan"; break;
1440 case QSGGeometry::DrawTriangles: d << "triangles"; break;
1441 default: break;
1442 }
1443
1444 d << "#V:" << g->vertexCount() << "#I:" << g->indexCount();
1445
1446 if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::FloatType) {
1447 float x1 = 1e10, x2 = -1e10, y1=1e10, y2=-1e10;
1448 int stride = g->sizeOfVertex();
1449 for (int i = 0; i < g->vertexCount(); ++i) {
1450 float x = ((float *)((char *)const_cast<QSGGeometry *>(g)->vertexData() + i * stride))[0];
1451 float y = ((float *)((char *)const_cast<QSGGeometry *>(g)->vertexData() + i * stride))[1];
1452
1453 x1 = qMin(x1, x);
1454 x2 = qMax(x2, x);
1455 y1 = qMin(y1, y);
1456 y2 = qMax(y2, y);
1457 }
1458
1459 d << "x1=" << x1 << "y1=" << y1 << "x2=" << x2 << "y2=" << y2;
1460 }
1461 }
1462
1463 if (n->material())
1464 d << "materialtype=" << n->material()->type();
1465
1466
1467 d << ')';
1468#ifdef QSG_RUNTIME_DESCRIPTION
1470#endif
1471 return d;
1472}
1473
1475{
1476 if (!n) {
1477 d << "ClipNode(null)";
1478 return d;
1479 }
1480 d << "ClipNode(" << Qt::hex << (const void *) n << Qt::dec;
1481
1482 if (n->childCount())
1483 d << "children=" << n->childCount();
1484
1485 d << "is rect?" << (n->isRectangular() ? "yes" : "no");
1486
1487 d << ')';
1488#ifdef QSG_RUNTIME_DESCRIPTION
1490#endif
1491 d << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1492 return d;
1493}
1494
1496{
1497 if (!n) {
1498 d << "TransformNode(null)";
1499 return d;
1500 }
1501 const QMatrix4x4 m = n->matrix();
1502 d << "TransformNode(";
1503 d << Qt::hex << (const void *) n << Qt::dec;
1504 if (m.isIdentity())
1505 d << "identity";
1506 else if (m.determinant() == 1 && m(0, 0) == 1 && m(1, 1) == 1 && m(2, 2) == 1)
1507 d << "translate" << m(0, 3) << m(1, 3) << m(2, 3);
1508 else
1509 d << "det=" << n->matrix().determinant();
1510#ifdef QSG_RUNTIME_DESCRIPTION
1512#endif
1513 d << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1514 d << ')';
1515 return d;
1516}
1517
1519{
1520 if (!n) {
1521 d << "OpacityNode(null)";
1522 return d;
1523 }
1524 d << "OpacityNode(";
1525 d << Qt::hex << (const void *) n << Qt::dec;
1526 d << "opacity=" << n->opacity()
1527 << "combined=" << n->combinedOpacity()
1528 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1529#ifdef QSG_RUNTIME_DESCRIPTION
1531#endif
1532 d << ')';
1533 return d;
1534}
1535
1536
1538{
1539 if (!n) {
1540 d << "RootNode(null)";
1541 return d;
1542 }
1543 QDebugStateSaver saver(d);
1544 d << "RootNode" << Qt::hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1545#ifdef QSG_RUNTIME_DESCRIPTION
1547#endif
1548 d << ')';
1549 return d;
1550}
1551
1552
1553
1555{
1556 if (!n) {
1557 d << "Node(null)";
1558 return d;
1559 }
1560 switch (n->type()) {
1562 d << static_cast<const QSGGeometryNode *>(n);
1563 break;
1565 d << static_cast<const QSGTransformNode *>(n);
1566 break;
1568 d << static_cast<const QSGClipNode *>(n);
1569 break;
1571 d << static_cast<const QSGRootNode *>(n);
1572 break;
1574 d << static_cast<const QSGOpacityNode *>(n);
1575 break;
1577 d << "RenderNode(" << Qt::hex << (const void *) n << Qt::dec
1578 << "flags=" << (int) n->flags() << Qt::dec
1579 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1580#ifdef QSG_RUNTIME_DESCRIPTION
1582#endif
1583 d << ')';
1584 break;
1585 default:
1586 d << "Node(" << Qt::hex << (const void *) n << Qt::dec
1587 << "flags=" << (int) n->flags() << Qt::dec
1588 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1589#ifdef QSG_RUNTIME_DESCRIPTION
1591#endif
1592 d << ')';
1593 break;
1594 }
1595 return d;
1596}
1597
1598#endif
1599
\inmodule QtCore
\inmodule QtCore
qsizetype size() const noexcept
Definition qlist.h:398
bool isEmpty() const noexcept
Definition qlist.h:402
const T & constLast() const noexcept
Definition qlist.h:651
const_reference at(qsizetype i) const noexcept
Definition qlist.h:447
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
\inmodule QtCore\reentrant
Definition qrect.h:484
void setRootNode(QSGRootNode *node)
Sets the node as the root of the QSGNode scene that you want to render.
virtual void nodeChanged(QSGNode *node, QSGNode::DirtyState state)=0
The QSGBasicGeometryNode class serves as a baseclass for geometry based nodes.
Definition qsgnode.h:155
QSGBasicGeometryNode(NodeType type)
Creates a new basic geometry node of type type.
Definition qsgnode.cpp:668
const QSGGeometry * geometry() const
Returns this node's geometry.
Definition qsgnode.h:160
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
Definition qsgnode.cpp:762
~QSGBasicGeometryNode() override
Deletes this QSGBasicGeometryNode.
Definition qsgnode.cpp:696
The QSGClipNode class implements the clipping functionality in the scene graph.
Definition qsgnode.h:221
QSGClipNode()
Creates a new QSGClipNode without a geometry.
Definition qsgnode.cpp:1037
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
Definition qsgnode.cpp:1099
void setIsRectangular(bool rectHint)
Sets whether this clip node has a rectangular clip to rectHint.
Definition qsgnode.cpp:1079
~QSGClipNode() override
Deletes this QSGClipNode.
Definition qsgnode.cpp:1053
The QSGGeometryNode class is used for all rendered content in the scene graph.
Definition qsgnode.h:188
void setRenderOrder(int order)
Sets the render order of this node to be order.
Definition qsgnode.cpp:908
QSGMaterial * material() const
Returns the material of the QSGGeometryNode.
Definition qsgnode.h:194
QSGMaterial * activeMaterial() const
Returns the material which should currently be used for geometry node.
Definition qsgnode.cpp:985
QSGGeometryNode()
Creates a new geometry node without geometry and material.
Definition qsgnode.cpp:824
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:925
~QSGGeometryNode() override
Deletes this geometry node.
Definition qsgnode.cpp:851
void setInheritedOpacity(qreal opacity)
Sets the inherited opacity of this geometry to opacity.
Definition qsgnode.cpp:1002
void setOpaqueMaterial(QSGMaterial *material)
Sets the opaque material of this geometry to material.
Definition qsgnode.cpp:956
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
int vertexCount() const
Returns the number of vertices in this geometry object.
The QSGMaterial class encapsulates rendering state for a shader program.
Definition qsgmaterial.h:15
static QString description(const QSGNode *node)
Definition qsgnode_p.h:34
static void setDescription(QSGNode *node, const QString &description)
Definition qsgnode_p.h:31
virtual void enterOpacityNode(QSGOpacityNode *)
Definition qsgnode.h:305
virtual void leaveGeometryNode(QSGGeometryNode *)
Definition qsgnode.h:304
virtual void enterTransformNode(QSGTransformNode *)
Definition qsgnode.h:299
virtual void visitChildren(QSGNode *n)
Definition qsgnode.cpp:1416
virtual void leaveTransformNode(QSGTransformNode *)
Definition qsgnode.h:300
virtual ~QSGNodeVisitor()
Definition qsgnode.cpp:1377
virtual void leaveOpacityNode(QSGOpacityNode *)
Definition qsgnode.h:306
virtual void visitNode(QSGNode *n)
Definition qsgnode.cpp:1383
virtual void leaveClipNode(QSGClipNode *)
Definition qsgnode.h:302
virtual void enterClipNode(QSGClipNode *)
Definition qsgnode.h:301
virtual void enterGeometryNode(QSGGeometryNode *)
Definition qsgnode.h:303
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
void removeChildNode(QSGNode *node)
Removes node from this node's list of children.
Definition qsgnode.cpp:498
QSGNode * childAtIndex(int i) const
Returns the child at index i.
Definition qsgnode.cpp:566
void prependChildNode(QSGNode *node)
Prepends node to this node's the list of children.
Definition qsgnode.cpp:365
Flags flags() const
Returns the set of flags for this node.
Definition qsgnode.h:118
@ DirtyMaterial
Definition qsgnode.h:75
@ DirtyNodeAdded
Definition qsgnode.h:72
@ DirtySubtreeBlocked
Definition qsgnode.h:70
@ DirtyNodeRemoved
Definition qsgnode.h:73
@ DirtyUsePreprocess
Definition qsgnode.h:80
@ DirtyOpacity
Definition qsgnode.h:76
@ DirtyGeometry
Definition qsgnode.h:74
@ DirtyMatrix
Definition qsgnode.h:71
void reparentChildNodesTo(QSGNode *newParent)
Definition qsgnode.cpp:545
int childCount() const
Returns the number of child nodes.
Definition qsgnode.cpp:554
virtual bool isSubtreeBlocked() const
Returns whether this node and its subtree is available for use.
Definition qsgnode.cpp:323
Flag
The QSGNode::Flag enum describes flags on the QSGNode.
Definition qsgnode.h:49
@ OwnedByParent
Definition qsgnode.h:51
@ UsePreprocess
Definition qsgnode.h:52
@ OwnsOpaqueMaterial
Definition qsgnode.h:59
@ OwnsMaterial
Definition qsgnode.h:58
@ OwnsGeometry
Definition qsgnode.h:57
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
Definition qsgnode.cpp:396
QT_DEPRECATED DirtyState dirtyState() const
Definition qsgnode.h:114
void insertChildNodeBefore(QSGNode *node, QSGNode *before)
Inserts node to this node's list of children before the node specified with before.
Definition qsgnode.cpp:429
friend class QSGNodePrivate
Definition qsgnode.h:147
NodeType
Can be used to figure out the type of node.
Definition qsgnode.h:39
@ TransformNodeType
Definition qsgnode.h:42
@ RootNodeType
Definition qsgnode.h:45
@ GeometryNodeType
Definition qsgnode.h:41
@ RenderNodeType
Definition qsgnode.h:46
@ ClipNodeType
Definition qsgnode.h:43
@ OpacityNodeType
Definition qsgnode.h:44
void insertChildNodeAfter(QSGNode *node, QSGNode *after)
Inserts node to this node's list of children after the node specified with after.
Definition qsgnode.cpp:465
virtual ~QSGNode()
Destroys the node.
Definition qsgnode.cpp:280
QSGNode * parent() const
Returns the parent node of this node.
Definition qsgnode.h:93
QSGNode * firstChild() const
Returns the first child of this node.
Definition qsgnode.h:105
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
Definition qsgnode.cpp:622
void setFlags(Flags, bool=true)
Sets the flags f on this node if enabled is true; otherwise clears the flags.
Definition qsgnode.cpp:603
QSGNode()
Constructs a new node.
Definition qsgnode.cpp:209
NodeType type() const
Returns the type of this node.
Definition qsgnode.h:110
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
Definition qsgnode.cpp:584
void removeAllChildNodes()
Removes all child nodes from this node's list of children.
Definition qsgnode.cpp:525
QScopedPointer< QSGNodePrivate > d_ptr
Definition qsgnode.h:149
The QSGOpacityNode class is used to change opacity of nodes.
Definition qsgnode.h:276
qreal opacity() const
Returns this opacity node's opacity.
Definition qsgnode.h:282
~QSGOpacityNode() override
Deletes the opacity node.
Definition qsgnode.cpp:1287
QSGOpacityNode()
Constructs an opacity node with a default opacity of 1.
Definition qsgnode.cpp:1276
void setCombinedOpacity(qreal opacity)
Sets the combined opacity of this node to opacity.
Definition qsgnode.cpp:1350
void setOpacity(qreal opacity)
Sets the opacity of this node to opacity.
Definition qsgnode.cpp:1310
bool isSubtreeBlocked() const override
For performance reasons, we block the subtree when the opacity is below a certain threshold.
Definition qsgnode.cpp:1364
The QSGRootNode is the toplevel root of any scene graph.
Definition qsgnode.h:259
~QSGRootNode() override
Deletes the root node.
Definition qsgnode.cpp:1223
QSGRootNode()
Creates a new root node.
Definition qsgnode.cpp:1210
The QSGTransformNode class implements transformations in the scene graph.
Definition qsgnode.h:241
void setMatrix(const QMatrix4x4 &matrix)
Sets this transform node's matrix to matrix.
Definition qsgnode.cpp:1160
void setCombinedMatrix(const QMatrix4x4 &matrix)
Sets the combined matrix of this matrix to transform.
Definition qsgnode.cpp:1186
const QMatrix4x4 & matrix() const
Returns this transform node's matrix.
Definition qsgnode.h:247
QSGTransformNode()
Create a new QSGTransformNode with its matrix set to the identity matrix.
Definition qsgnode.cpp:1131
~QSGTransformNode() override
Deletes this transform node.
Definition qsgnode.cpp:1142
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
rect
[4]
else opt state
[0]
short next
Definition keywords.cpp:445
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
Flags
#define qWarning
Definition qlogging.h:167
#define qCDebug(category,...)
QT_BEGIN_NAMESPACE constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:19
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:21
GLint GLint GLint GLint GLint x
[0]
const GLfloat * m
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLfloat GLfloat f
const void GLsizei GLsizei stride
GLenum type
GLboolean GLboolean g
GLfloat n
GLint y
const GLubyte * c
GLfixed GLfixed GLfixed y2
GLuint GLenum matrix
GLfixed GLfixed x2
GLdouble GLdouble t
Definition qopenglext.h:243
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLfloat GLfloat p
[1]
GLfixed GLfixed GLint GLint order
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
void qsgnode_set_description(QSGNode *node, const QString &description)
Definition qsgnode.cpp:639
static void qt_print_node_count()
Definition qsgnode.cpp:17
static QT_BEGIN_NAMESPACE int qt_node_count
Definition qsgnode.cpp:15
QDebug operator<<(QDebug d, const QSGGeometryNode *n)
Definition qsgnode.cpp:1423
const qreal OPACITY_THRESHOLD
Definition qsgnode.cpp:1299
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:187
float vertexData[]
QObject::connect nullptr
QLayoutItem * child
[0]