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
15
16#ifndef QT_NO_DEBUG
17static int qt_node_count = 0;
18
20{
21 qCDebug(lcQsgLeak, "Number of leaked nodes: %i", qt_node_count);
22 qt_node_count = -1;
23}
24#endif
25
212 : m_nodeFlags(OwnedByParent)
213{
214 init();
215}
216
223 : m_parent(nullptr)
224 , m_type(type)
225 , m_firstChild(nullptr)
226 , m_lastChild(nullptr)
227 , m_nextSibling(nullptr)
228 , m_previousSibling(nullptr)
229 , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
230 , m_nodeFlags(OwnedByParent)
231{
232 init();
233}
234
241 : m_parent(nullptr)
242 , m_type(type)
243 , m_firstChild(nullptr)
244 , m_lastChild(nullptr)
245 , m_nextSibling(nullptr)
246 , m_previousSibling(nullptr)
247 , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0)
248 , m_nodeFlags(OwnedByParent)
249 , d_ptr(&dd)
250{
251 init();
252}
253
257void QSGNode::init()
258{
259#ifndef QT_NO_DEBUG
260 if (lcQsgLeak().isDebugEnabled()) {
262 static bool atexit_registered = false;
263 if (!atexit_registered) {
264 atexit(qt_print_node_count);
265 atexit_registered = true;
266 }
267 }
268#endif
269
270#ifdef QSG_RUNTIME_DESCRIPTION
271 if (d_ptr.isNull())
273#endif
274}
275
283{
284#ifndef QT_NO_DEBUG
285 if (lcQsgLeak().isDebugEnabled()) {
287 if (qt_node_count < 0)
288 qCDebug(lcQsgLeak, "Node destroyed after qt_print_node_count() was called.");
289 }
290#endif
291 destroy();
292}
293
294
326{
327 return false;
328}
329
342void QSGNode::destroy()
343{
344 if (m_parent) {
345 m_parent->removeChildNode(this);
346 Q_ASSERT(m_parent == nullptr);
347 }
348 while (m_firstChild) {
349 QSGNode *child = m_firstChild;
351 Q_ASSERT(child->m_parent == nullptr);
352 if (child->flags() & OwnedByParent)
353 delete child;
354 }
355
356 Q_ASSERT(m_firstChild == nullptr && m_lastChild == nullptr);
357}
358
359
368{
369 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::prependChildNode", "QSGNode is already a child!");
370 Q_ASSERT_X(!node->m_parent, "QSGNode::prependChildNode", "QSGNode already has a parent");
371
372#ifndef QT_NO_DEBUG
373 if (node->type() == QSGNode::GeometryNodeType) {
374 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
375 Q_ASSERT_X(g->material(), "QSGNode::prependChildNode", "QSGGeometryNode is missing material");
376 Q_ASSERT_X(g->geometry(), "QSGNode::prependChildNode", "QSGGeometryNode is missing geometry");
377 }
378#endif
379
380 if (m_firstChild)
381 m_firstChild->m_previousSibling = node;
382 else
383 m_lastChild = node;
384 node->m_nextSibling = m_firstChild;
385 m_firstChild = node;
386 node->m_parent = this;
387
389}
390
399{
400 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::appendChildNode", "QSGNode is already a child!");
401 Q_ASSERT_X(!node->m_parent, "QSGNode::appendChildNode", "QSGNode already has a parent");
402
403#ifndef QT_NO_DEBUG
404 if (node->type() == QSGNode::GeometryNodeType) {
405 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
406 Q_ASSERT_X(g->material(), "QSGNode::appendChildNode", "QSGGeometryNode is missing material");
407 Q_ASSERT_X(g->geometry(), "QSGNode::appendChildNode", "QSGGeometryNode is missing geometry");
408 }
409#endif
410
411 if (m_lastChild)
412 m_lastChild->m_nextSibling = node;
413 else
414 m_firstChild = node;
415 node->m_previousSibling = m_lastChild;
416 m_lastChild = node;
417 node->m_parent = this;
418
420}
421
422
423
432{
433 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::insertChildNodeBefore", "QSGNode is already a child!");
434 Q_ASSERT_X(!node->m_parent, "QSGNode::insertChildNodeBefore", "QSGNode already has a parent");
435 Q_ASSERT_X(before && before->m_parent == this, "QSGNode::insertChildNodeBefore", "The parent of \'before\' is wrong");
436
437#ifndef QT_NO_DEBUG
438 if (node->type() == QSGNode::GeometryNodeType) {
439 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
440 Q_ASSERT_X(g->material(), "QSGNode::insertChildNodeBefore", "QSGGeometryNode is missing material");
441 Q_ASSERT_X(g->geometry(), "QSGNode::insertChildNodeBefore", "QSGGeometryNode is missing geometry");
442 }
443#endif
444
445 QSGNode *previous = before->m_previousSibling;
446 if (previous)
447 previous->m_nextSibling = node;
448 else
449 m_firstChild = node;
450 node->m_previousSibling = previous;
451 node->m_nextSibling = before;
452 before->m_previousSibling = node;
453 node->m_parent = this;
454
456}
457
458
459
468{
469 //Q_ASSERT_X(!m_children.contains(node), "QSGNode::insertChildNodeAfter", "QSGNode is already a child!");
470 Q_ASSERT_X(!node->m_parent, "QSGNode::insertChildNodeAfter", "QSGNode already has a parent");
471 Q_ASSERT_X(after && after->m_parent == this, "QSGNode::insertChildNodeAfter", "The parent of \'after\' is wrong");
472
473#ifndef QT_NO_DEBUG
474 if (node->type() == QSGNode::GeometryNodeType) {
475 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(node);
476 Q_ASSERT_X(g->material(), "QSGNode::insertChildNodeAfter", "QSGGeometryNode is missing material");
477 Q_ASSERT_X(g->geometry(), "QSGNode::insertChildNodeAfter", "QSGGeometryNode is missing geometry");
478 }
479#endif
480
481 QSGNode *next = after->m_nextSibling;
482 if (next)
483 next->m_previousSibling = node;
484 else
485 m_lastChild = node;
486 node->m_nextSibling = next;
487 node->m_previousSibling = after;
488 after->m_nextSibling = node;
489 node->m_parent = this;
490
492}
493
494
495
501{
502 //Q_ASSERT(m_children.contains(node));
503 Q_ASSERT(node->parent() == this);
504
505 QSGNode *previous = node->m_previousSibling;
506 QSGNode *next = node->m_nextSibling;
507 if (previous)
508 previous->m_nextSibling = next;
509 else
510 m_firstChild = next;
511 if (next)
512 next->m_previousSibling = previous;
513 else
514 m_lastChild = previous;
515 node->m_previousSibling = nullptr;
516 node->m_nextSibling = nullptr;
517
519 node->m_parent = nullptr;
520}
521
522
528{
529 while (m_firstChild) {
530 QSGNode *node = m_firstChild;
531 m_firstChild = node->m_nextSibling;
532 node->m_nextSibling = nullptr;
533 if (m_firstChild)
534 m_firstChild->m_previousSibling = nullptr;
535 else
536 m_lastChild = nullptr;
538 node->m_parent = nullptr;
539 }
540}
541
548{
549 for (QSGNode *c = firstChild(); c; c = firstChild()) {
551 newParent->appendChildNode(c);
552 }
553}
554
555
557{
558 int count = 0;
559 QSGNode *n = m_firstChild;
560 while (n) {
561 ++count;
562 n = n->m_nextSibling;
563 }
564 return count;
565}
566
567
569{
570 QSGNode *n = m_firstChild;
571 while (i && n) {
572 --i;
573 n = n->m_nextSibling;
574 }
575 return n;
576}
577
578
587{
588 if (bool(m_nodeFlags & f) == enabled)
589 return;
590 m_nodeFlags ^= f;
592 int changedFlag = f & UsePreprocess;
593 if (changedFlag)
594 markDirty(DirtyState(changedFlag));
595}
596
597
606{
607 Flags oldFlags = m_nodeFlags;
608 if (enabled)
609 m_nodeFlags |= f;
610 else
611 m_nodeFlags &= ~f;
613 int changedFlags = (oldFlags ^ m_nodeFlags) & UsePreprocess;
614 if (changedFlags)
615 markDirty(DirtyState(changedFlags));
616}
617
618
619
624void QSGNode::markDirty(DirtyState bits)
625{
626 int renderableCountDiff = 0;
627 if (bits & DirtyNodeAdded)
628 renderableCountDiff += m_subtreeRenderableCount;
630 renderableCountDiff -= m_subtreeRenderableCount;
631
632 QSGNode *p = m_parent;
633 while (p) {
634 p->m_subtreeRenderableCount += renderableCountDiff;
635 if (p->type() == RootNodeType)
636 static_cast<QSGRootNode *>(p)->notifyNodeChange(this, bits);
637 p = p->m_parent;
638 }
639}
640
641void qsgnode_set_description(QSGNode *node, const QString &description)
642{
643#ifdef QSG_RUNTIME_DESCRIPTION
644 QSGNodePrivate::setDescription(node, description);
645#else
646 Q_UNUSED(node);
647 Q_UNUSED(description);
648#endif
649}
650
671 : QSGNode(type)
672 , m_geometry(nullptr)
673 , m_matrix(nullptr)
674 , m_clip_list(nullptr)
675{
676}
677
678
683 : QSGNode(dd, type)
684 , m_geometry(nullptr)
685 , m_matrix(nullptr)
686 , m_clip_list(nullptr)
687{
688}
689
690
699{
700 if (flags() & OwnsGeometry)
701 delete m_geometry;
702}
703
704
765{
766 if ((flags() & OwnsGeometry) != 0 && m_geometry != geometry)
767 delete m_geometry;
768 m_geometry = geometry;
770}
771
772
773
827 : QSGBasicGeometryNode(GeometryNodeType)
828{
829}
830
831
836 : QSGBasicGeometryNode(dd, GeometryNodeType)
837 , m_render_order(0)
838 , m_material(nullptr)
839 , m_opaque_material(nullptr)
840 , m_opacity(1)
841{
842}
843
844
854{
855 if (flags() & OwnsMaterial)
856 delete m_material;
858 delete m_opaque_material;
859}
860
861
862
911{
912 m_render_order = order;
913}
914
915
916
928{
929 if ((flags() & OwnsMaterial) != 0 && m_material != material)
930 delete m_material;
931 m_material = material;
932#ifndef QT_NO_DEBUG
933 if (m_material != nullptr && m_opaque_material == m_material)
934 qWarning("QSGGeometryNode: using same material for both opaque and translucent");
935#endif
937}
938
939
940
959{
960 if ((flags() & OwnsOpaqueMaterial) != 0 && m_opaque_material != m_material)
961 delete m_opaque_material;
962 m_opaque_material = material;
963#ifndef QT_NO_DEBUG
964 if (m_opaque_material != nullptr && m_opaque_material == m_material)
965 qWarning("QSGGeometryNode: using same material for both opaque and translucent");
966#endif
967
969}
970
971
972
988{
989 if (m_opaque_material && m_opacity > 0.999)
990 return m_opaque_material;
991 return m_material;
992}
993
994
1005{
1006 Q_ASSERT(opacity >= 0 && opacity <= 1);
1007 m_opacity = opacity;
1008}
1009
1010
1040 : QSGBasicGeometryNode(ClipNodeType)
1041 , m_is_rectangular(false)
1042{
1043 Q_UNUSED(m_reserved);
1044}
1045
1046
1047
1058
1059
1060
1082{
1083 m_is_rectangular = rectHint;
1084}
1085
1086
1087
1102{
1103 m_clip_rect = rect;
1104}
1105
1106
1134 : QSGNode(TransformNodeType)
1135{
1136}
1137
1138
1139
1147
1148
1149
1163{
1164 m_matrix = matrix;
1166}
1167
1189{
1190 m_combined_matrix = matrix;
1191}
1192
1193
1194
1213 : QSGNode(RootNodeType)
1214{
1215}
1216
1217
1226{
1227 while (!m_renderers.isEmpty())
1228 m_renderers.constLast()->setRootNode(nullptr);
1229 destroy(); // Must call destroy() here because markDirty() casts this to QSGRootNode.
1230}
1231
1232
1233
1239void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state)
1240{
1241 for (int i=0; i<m_renderers.size(); ++i) {
1242 m_renderers.at(i)->nodeChanged(node, state);
1243 }
1244}
1245
1246
1247
1279 : QSGNode(OpacityNodeType)
1280{
1281}
1282
1283
1284
1292
1293
1294
1302
1313{
1314 opacity = qBound<qreal>(0, opacity, 1);
1315 if (m_opacity == opacity)
1316 return;
1317 DirtyState dirtyState = DirtyOpacity;
1318
1319 if ((m_opacity < OPACITY_THRESHOLD && opacity >= OPACITY_THRESHOLD) // blocked to unblocked
1320 || (m_opacity >= OPACITY_THRESHOLD && opacity < OPACITY_THRESHOLD)) // unblocked to blocked
1322
1323 m_opacity = opacity;
1325}
1326
1327
1328
1353{
1354 m_combined_opacity = opacity;
1355}
1356
1357
1358
1367{
1368 return m_opacity < OPACITY_THRESHOLD;
1369}
1370
1371
1383
1384
1386{
1387 switch (n->type()) {
1389 QSGTransformNode *t = static_cast<QSGTransformNode *>(n);
1393 break; }
1395 QSGGeometryNode *g = static_cast<QSGGeometryNode *>(n);
1399 break; }
1400 case QSGNode::ClipNodeType: {
1401 QSGClipNode *c = static_cast<QSGClipNode *>(n);
1405 break; }
1407 QSGOpacityNode *o = static_cast<QSGOpacityNode *>(n);
1411 break; }
1412 default:
1414 break;
1415 }
1416}
1417
1419{
1420 for (QSGNode *c = n->firstChild(); c; c = c->nextSibling())
1421 visitNode(c);
1422}
1423
1424#ifndef QT_NO_DEBUG_STREAM
1426{
1427 if (!n) {
1428 d << "Geometry(null)";
1429 return d;
1430 }
1431 d << "GeometryNode(" << Qt::hex << (const void *) n << Qt::dec;
1432
1433 const QSGGeometry *g = n->geometry();
1434
1435 if (!g) {
1436 d << "no geometry";
1437 } else {
1438
1439 switch (g->drawingMode()) {
1440 case QSGGeometry::DrawTriangleStrip: d << "strip"; break;
1441 case QSGGeometry::DrawTriangleFan: d << "fan"; break;
1442 case QSGGeometry::DrawTriangles: d << "triangles"; break;
1443 default: break;
1444 }
1445
1446 d << "#V:" << g->vertexCount() << "#I:" << g->indexCount();
1447
1448 if (g->attributeCount() > 0 && g->attributes()->type == QSGGeometry::FloatType) {
1449 float x1 = 1e10, x2 = -1e10, y1=1e10, y2=-1e10;
1450 int stride = g->sizeOfVertex();
1451 for (int i = 0; i < g->vertexCount(); ++i) {
1452 float x = ((float *)((char *)const_cast<QSGGeometry *>(g)->vertexData() + i * stride))[0];
1453 float y = ((float *)((char *)const_cast<QSGGeometry *>(g)->vertexData() + i * stride))[1];
1454
1455 x1 = qMin(x1, x);
1456 x2 = qMax(x2, x);
1457 y1 = qMin(y1, y);
1458 y2 = qMax(y2, y);
1459 }
1460
1461 d << "x1=" << x1 << "y1=" << y1 << "x2=" << x2 << "y2=" << y2;
1462 }
1463 }
1464
1465 if (n->material())
1466 d << "materialtype=" << n->material()->type();
1467
1468
1469 d << ')';
1470#ifdef QSG_RUNTIME_DESCRIPTION
1472#endif
1473 return d;
1474}
1475
1477{
1478 if (!n) {
1479 d << "ClipNode(null)";
1480 return d;
1481 }
1482 d << "ClipNode(" << Qt::hex << (const void *) n << Qt::dec;
1483
1484 if (n->childCount())
1485 d << "children=" << n->childCount();
1486
1487 d << "is rect?" << (n->isRectangular() ? "yes" : "no");
1488
1489 d << ')';
1490#ifdef QSG_RUNTIME_DESCRIPTION
1492#endif
1493 d << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1494 return d;
1495}
1496
1498{
1499 if (!n) {
1500 d << "TransformNode(null)";
1501 return d;
1502 }
1503 const QMatrix4x4 m = n->matrix();
1504 d << "TransformNode(";
1505 d << Qt::hex << (const void *) n << Qt::dec;
1506 if (m.isIdentity())
1507 d << "identity";
1508 else if (m.determinant() == 1 && m(0, 0) == 1 && m(1, 1) == 1 && m(2, 2) == 1)
1509 d << "translate" << m(0, 3) << m(1, 3) << m(2, 3);
1510 else
1511 d << "det=" << n->matrix().determinant();
1512#ifdef QSG_RUNTIME_DESCRIPTION
1514#endif
1515 d << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1516 d << ')';
1517 return d;
1518}
1519
1521{
1522 if (!n) {
1523 d << "OpacityNode(null)";
1524 return d;
1525 }
1526 d << "OpacityNode(";
1527 d << Qt::hex << (const void *) n << Qt::dec;
1528 d << "opacity=" << n->opacity()
1529 << "combined=" << n->combinedOpacity()
1530 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1531#ifdef QSG_RUNTIME_DESCRIPTION
1533#endif
1534 d << ')';
1535 return d;
1536}
1537
1538
1540{
1541 if (!n) {
1542 d << "RootNode(null)";
1543 return d;
1544 }
1545 QDebugStateSaver saver(d);
1546 d << "RootNode" << Qt::hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1547#ifdef QSG_RUNTIME_DESCRIPTION
1549#endif
1550 d << ')';
1551 return d;
1552}
1553
1554
1555
1557{
1558 if (!n) {
1559 d << "Node(null)";
1560 return d;
1561 }
1562 switch (n->type()) {
1564 d << static_cast<const QSGGeometryNode *>(n);
1565 break;
1567 d << static_cast<const QSGTransformNode *>(n);
1568 break;
1570 d << static_cast<const QSGClipNode *>(n);
1571 break;
1573 d << static_cast<const QSGRootNode *>(n);
1574 break;
1576 d << static_cast<const QSGOpacityNode *>(n);
1577 break;
1579 d << "RenderNode(" << Qt::hex << (const void *) n << Qt::dec
1580 << "flags=" << (int) n->flags() << Qt::dec
1581 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1582#ifdef QSG_RUNTIME_DESCRIPTION
1584#endif
1585 d << ')';
1586 break;
1587 default:
1588 d << "Node(" << Qt::hex << (const void *) n << Qt::dec
1589 << "flags=" << (int) n->flags() << Qt::dec
1590 << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
1591#ifdef QSG_RUNTIME_DESCRIPTION
1593#endif
1594 d << ')';
1595 break;
1596 }
1597 return d;
1598}
1599
1600#endif
1601
\inmodule QtCore
\inmodule QtCore
qsizetype size() const noexcept
Definition qlist.h:397
bool isEmpty() const noexcept
Definition qlist.h:401
const T & constLast() const noexcept
Definition qlist.h:650
const_reference at(qsizetype i) const noexcept
Definition qlist.h:446
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:670
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:764
~QSGBasicGeometryNode() override
Deletes this QSGBasicGeometryNode.
Definition qsgnode.cpp:698
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:1039
void setClipRect(const QRectF &)
Sets the clip rect of this clip node to rect.
Definition qsgnode.cpp:1101
void setIsRectangular(bool rectHint)
Sets whether this clip node has a rectangular clip to rectHint.
Definition qsgnode.cpp:1081
~QSGClipNode() override
Deletes this QSGClipNode.
Definition qsgnode.cpp:1055
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:910
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:987
QSGGeometryNode()
Creates a new geometry node without geometry and material.
Definition qsgnode.cpp:826
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
Definition qsgnode.cpp:927
~QSGGeometryNode() override
Deletes this geometry node.
Definition qsgnode.cpp:853
void setInheritedOpacity(qreal opacity)
Sets the inherited opacity of this geometry to opacity.
Definition qsgnode.cpp:1004
void setOpaqueMaterial(QSGMaterial *material)
Sets the opaque material of this geometry to material.
Definition qsgnode.cpp:958
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:1418
virtual void leaveTransformNode(QSGTransformNode *)
Definition qsgnode.h:300
virtual ~QSGNodeVisitor()
Definition qsgnode.cpp:1379
virtual void leaveOpacityNode(QSGOpacityNode *)
Definition qsgnode.h:306
virtual void visitNode(QSGNode *n)
Definition qsgnode.cpp:1385
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:500
QSGNode * childAtIndex(int i) const
Returns the child at index i.
Definition qsgnode.cpp:568
void prependChildNode(QSGNode *node)
Prepends node to this node's the list of children.
Definition qsgnode.cpp:367
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:547
int childCount() const
Returns the number of child nodes.
Definition qsgnode.cpp:556
virtual bool isSubtreeBlocked() const
Returns whether this node and its subtree is available for use.
Definition qsgnode.cpp:325
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:398
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:431
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:467
virtual ~QSGNode()
Destroys the node.
Definition qsgnode.cpp:282
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:624
void setFlags(Flags, bool=true)
Sets the flags f on this node if enabled is true; otherwise clears the flags.
Definition qsgnode.cpp:605
QSGNode()
Constructs a new node.
Definition qsgnode.cpp:211
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:586
void removeAllChildNodes()
Removes all child nodes from this node's list of children.
Definition qsgnode.cpp:527
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:1289
QSGOpacityNode()
Constructs an opacity node with a default opacity of 1.
Definition qsgnode.cpp:1278
void setCombinedOpacity(qreal opacity)
Sets the combined opacity of this node to opacity.
Definition qsgnode.cpp:1352
void setOpacity(qreal opacity)
Sets the opacity of this node to opacity.
Definition qsgnode.cpp:1312
bool isSubtreeBlocked() const override
For performance reasons, we block the subtree when the opacity is below a certain threshold.
Definition qsgnode.cpp:1366
The QSGRootNode is the toplevel root of any scene graph.
Definition qsgnode.h:259
~QSGRootNode() override
Deletes the root node.
Definition qsgnode.cpp:1225
QSGRootNode()
Creates a new root node.
Definition qsgnode.cpp:1212
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:1162
void setCombinedMatrix(const QMatrix4x4 &matrix)
Sets the combined matrix of this matrix to transform.
Definition qsgnode.cpp:1188
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:1133
~QSGTransformNode() override
Deletes this transform node.
Definition qsgnode.cpp:1144
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:166
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
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
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:641
static void qt_print_node_count()
Definition qsgnode.cpp:19
static QT_BEGIN_NAMESPACE int qt_node_count
Definition qsgnode.cpp:17
QDebug operator<<(QDebug d, const QSGGeometryNode *n)
Definition qsgnode.cpp:1425
const qreal OPACITY_THRESHOLD
Definition qsgnode.cpp:1301
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:187
float vertexData[]
QObject::connect nullptr
QLayoutItem * child
[0]