Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes More...
#include <qsgnode.h>
Public Types | |
enum | NodeType { BasicNodeType , GeometryNodeType , TransformNodeType , ClipNodeType , OpacityNodeType , RootNodeType , RenderNodeType } |
Can be used to figure out the type of node. More... | |
enum | Flag { OwnedByParent = 0x0001 , UsePreprocess = 0x0002 , OwnsGeometry = 0x00010000 , OwnsMaterial = 0x00020000 , OwnsOpaqueMaterial = 0x00040000 , IsVisitableNode = 0x01000000 } |
The QSGNode::Flag enum describes flags on the QSGNode. More... | |
enum | DirtyStateBit { DirtySubtreeBlocked = 0x0080 , DirtyMatrix = 0x0100 , DirtyNodeAdded = 0x0400 , DirtyNodeRemoved = 0x0800 , DirtyGeometry = 0x1000 , DirtyMaterial = 0x2000 , DirtyOpacity = 0x4000 , DirtyForceUpdate = 0x8000 , DirtyUsePreprocess = UsePreprocess , DirtyPropagationMask } |
Used in QSGNode::markDirty() to indicate how the scene graph has changed. More... | |
Public Member Functions | |
QSGNode () | |
Constructs a new node. | |
virtual | ~QSGNode () |
Destroys the node. | |
QSGNode * | parent () const |
Returns the parent node of this node. | |
void | removeChildNode (QSGNode *node) |
Removes node from this node's list of children. | |
void | removeAllChildNodes () |
Removes all child nodes from this node's list of children. | |
void | prependChildNode (QSGNode *node) |
Prepends node to this node's the list of children. | |
void | appendChildNode (QSGNode *node) |
Appends node to this node's list of children. | |
void | insertChildNodeBefore (QSGNode *node, QSGNode *before) |
Inserts node to this node's list of children before the node specified with before. | |
void | insertChildNodeAfter (QSGNode *node, QSGNode *after) |
Inserts node to this node's list of children after the node specified with after. | |
void | reparentChildNodesTo (QSGNode *newParent) |
int | childCount () const |
Returns the number of child nodes. | |
QSGNode * | childAtIndex (int i) const |
Returns the child at index i. | |
QSGNode * | firstChild () const |
Returns the first child of this node. | |
QSGNode * | lastChild () const |
Returns the last child of this node. | |
QSGNode * | nextSibling () const |
Returns the node after this in the parent's list of children. | |
QSGNode * | previousSibling () const |
Returns the node before this in the parent's list of children. | |
NodeType | type () const |
Returns the type of this node. | |
QT_DEPRECATED void | clearDirty () |
void | markDirty (DirtyState bits) |
Notifies all connected renderers that the node has dirty bits. | |
QT_DEPRECATED DirtyState | dirtyState () const |
virtual bool | isSubtreeBlocked () const |
Returns whether this node and its subtree is available for use. | |
Flags | flags () const |
Returns the set of flags for this node. | |
void | setFlag (Flag, bool=true) |
Sets the flag f on this node if enabled is true; otherwise clears the flag. | |
void | setFlags (Flags, bool=true) |
Sets the flags f on this node if enabled is true; otherwise clears the flags. | |
virtual void | preprocess () |
Override this function to do processing on the node before it is rendered. | |
Protected Member Functions | |
QSGNode (NodeType type) | |
Constructs a new node with the given node type. | |
QSGNode (QSGNodePrivate &dd, NodeType type) | |
Constructs a new node with the given node type. | |
Protected Attributes | |
QScopedPointer< QSGNodePrivate > | d_ptr |
Friends | |
class | QSGRootNode |
class | QSGBatchRenderer::Renderer |
class | QSGRenderer |
class | QSGNodePrivate |
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Nodes that can be used as part of the scene graph.
This page lists the nodes in \l {Qt Quick}'s \l {scene graph}{Qt Quick Scene Graph}.
The QSGNode class is the base class for all nodes in the scene graph.
\inmodule QtQuick
The QSGNode class can be used as a child container. Children are added with the appendChildNode(), prependChildNode(), insertChildNodeBefore() and insertChildNodeAfter(). The order of nodes is important as geometry nodes are rendered according to their ordering in the scene graph.
The scene graph nodes contain a mechanism that describes which parts of the scene have changed. This includes the combined matrices, accumulated opacity, changes to the node hierarchy, and so on. This information can be used for optimizations inside the scene graph renderer. For the renderer to properly render the nodes, it is important that users call QSGNode::markDirty() with the correct flags when nodes are changed. Most of the functions on the node classes will implicitly call markDirty(). For example, QSGNode::appendChildNode() will call markDirty() passing in QSGNode::DirtyNodeAdded.
If nodes change every frame, the preprocess() function can be used to apply changes to a node for every frame it is rendered. The use of preprocess() must be explicitly enabled by setting the QSGNode::UsePreprocess flag on the node.
The virtual isSubtreeBlocked() function can be used to disable a subtree all together. Nodes in a blocked subtree will not be preprocessed() and not rendered.
Used in QSGNode::markDirty() to indicate how the scene graph has changed.
\value DirtyMatrix The matrix in a QSGTransformNode has changed. \value DirtyNodeAdded A node was added. \value DirtyNodeRemoved A node was removed. \value DirtyGeometry The geometry of a QSGGeometryNode has changed. \value DirtyMaterial The material of a QSGGeometryNode has changed. \value DirtyOpacity The opacity of a QSGOpacityNode has changed. \value DirtySubtreeBlocked The subtree has been blocked.
\omitvalue DirtyForceUpdate \omitvalue DirtyUsePreprocess \omitvalue DirtyPropagationMask
Enumerator | |
---|---|
DirtySubtreeBlocked | |
DirtyMatrix | |
DirtyNodeAdded | |
DirtyNodeRemoved | |
DirtyGeometry | |
DirtyMaterial | |
DirtyOpacity | |
DirtyForceUpdate | |
DirtyUsePreprocess | |
DirtyPropagationMask |
enum QSGNode::Flag |
The QSGNode::Flag enum describes flags on the QSGNode.
\value OwnedByParent The node is owned by its parent and will be deleted when the parent is deleted. \value UsePreprocess The node's virtual preprocess() function will be called before rendering starts. \value OwnsGeometry Only valid for QSGGeometryNode and QSGClipNode. The node has ownership over the QSGGeometry instance and will delete it when the node is destroyed or a geometry is assigned. \value OwnsMaterial Only valid for QSGGeometryNode. The node has ownership over the material and will delete it when the node is destroyed or a material is assigned. \value OwnsOpaqueMaterial Only valid for QSGGeometryNode. The node has ownership over the opaque material and will delete it when the node is destroyed or a material is assigned. \value InternalReserved Reserved for internal use.
\omitvalue IsVisitableNode
Enumerator | |
---|---|
OwnedByParent | |
UsePreprocess | |
OwnsGeometry | |
OwnsMaterial | |
OwnsOpaqueMaterial | |
IsVisitableNode |
enum QSGNode::NodeType |
Can be used to figure out the type of node.
\value BasicNodeType The type of QSGNode \value GeometryNodeType The type of QSGGeometryNode \value TransformNodeType The type of QSGTransformNode \value ClipNodeType The type of QSGClipNode \value OpacityNodeType The type of QSGOpacityNode \value RenderNodeType The type of QSGRenderNode
\omitvalue RootNodeType
Enumerator | |
---|---|
BasicNodeType | |
GeometryNodeType | |
TransformNodeType | |
ClipNodeType | |
OpacityNodeType | |
RootNodeType | |
RenderNodeType |
QSGNode::QSGNode | ( | ) |
Constructs a new node.
Definition at line 209 of file qsgnode.cpp.
|
virtual |
Destroys the node.
Every child of this node that has the flag QSGNode::OwnedByParent set, will also be deleted.
Definition at line 280 of file qsgnode.cpp.
|
protected |
Constructs a new node with the given node type.
Definition at line 220 of file qsgnode.cpp.
|
protected |
Constructs a new node with the given node type.
Definition at line 238 of file qsgnode.cpp.
Appends node to this node's list of children.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
Definition at line 396 of file qsgnode.cpp.
QSGNode * QSGNode::childAtIndex | ( | int | i | ) | const |
Returns the child at index i.
Children are stored internally as a linked list, so iterating over the children via the index is suboptimal.
Definition at line 566 of file qsgnode.cpp.
int QSGNode::childCount | ( | ) | const |
Returns the number of child nodes.
Definition at line 554 of file qsgnode.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Inserts node to this node's list of children after the node specified with after.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
Definition at line 465 of file qsgnode.cpp.
Inserts node to this node's list of children before the node specified with before.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
Definition at line 429 of file qsgnode.cpp.
|
virtual |
Returns whether this node and its subtree is available for use.
Blocked subtrees will not get their dirty states updated and they will not be rendered.
The QSGOpacityNode will return a blocked subtree when accumulated opacity is 0, for instance.
Reimplemented in QSGOpacityNode.
Definition at line 323 of file qsgnode.cpp.
|
inline |
void QSGNode::markDirty | ( | DirtyState | bits | ) |
Notifies all connected renderers that the node has dirty bits.
Definition at line 622 of file qsgnode.cpp.
|
inline |
|
inline |
Prepends node to this node's the list of children.
Ordering of nodes is important as geometry nodes will be rendered in the order they are added to the scene graph.
Definition at line 365 of file qsgnode.cpp.
|
inlinevirtual |
Override this function to do processing on the node before it is rendered.
Preprocessing needs to be explicitly enabled by setting the flag QSGNode::UsePreprocess. The flag needs to be set before the node is added to the scene graph and will cause the preprocess() function to be called for every frame the node is rendered.
Reimplemented in QQuickShapeGenericStrokeFillNode, QSGBasicInternalImageNode, QSGCurveFillNode, QSGCurveGlyphNode, QSGDefaultGlyphNode, QSGDistanceFieldGlyphNode, QSGOpenVGInternalImageNode, QSGRhiShaderEffectNode, QSGSoftwareInternalImageNode, and SGFramebufferObjectNode.
|
inline |
void QSGNode::removeAllChildNodes | ( | ) |
Removes all child nodes from this node's list of children.
Definition at line 525 of file qsgnode.cpp.
Removes node from this node's list of children.
Definition at line 498 of file qsgnode.cpp.
Reparents all nodes of this node to newParent.
Definition at line 545 of file qsgnode.cpp.
Sets the flag f on this node if enabled is true; otherwise clears the flag.
Definition at line 584 of file qsgnode.cpp.
Sets the flags f on this node if enabled is true; otherwise clears the flags.
Definition at line 603 of file qsgnode.cpp.
|
inline |
Returns the type of this node.
The node type must be one of the predefined types defined in QSGNode::NodeType and can safely be used to cast to the corresponding class.
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |