16 FirstReservedRole = 0xff - 10,
24 inline QSGNode::Flags nodeRoleFlags( quint8 role )
26 return static_cast< QSGNode::Flags
>( ( role + 1 ) << 8 );
29 inline quint8 nodeRole( QSGNode::Flags flags )
31 return static_cast< quint8
>( ( ( flags & 0x0ffff ) >> 8 ) - 1 );
34 inline quint8 nodeRole(
const QSGNode* node )
36 return node ? nodeRole( node->flags() ) : 0xff;
39 inline void setNodeRole( QSGNode* node, quint8 role )
42 node->setFlags( node->flags() | nodeRoleFlags( role ) );
45 QSK_EXPORT QSGNode* findChildNode( QSGNode* parent, quint8 role );
46 QSK_EXPORT
bool removeChildNode( QSGNode* parent, quint8 role );
49 QSK_EXPORT
void replaceChildNode(
50 const QVector< quint8 >& roles, quint8 role,
51 QSGNode* parentNode, QSGNode* oldNode, QSGNode* newNode );
54 QSK_EXPORT
void removeAllChildNodesAfter( QSGNode* parent, QSGNode* child );
57 QSK_EXPORT
void removeAllChildNodesFrom( QSGNode* parent, QSGNode* child );
59 QSK_EXPORT
void setParentNode( QSGNode* child, QSGNode* parent );
61 template<
typename Node >
62 inline Node* createNode( quint8 role )
64 auto node =
new Node();
65 setNodeRole( node, role );
70 template<
typename Node >
71 inline Node* appendChildNode( QSGNode* parent, quint8 role )
73 auto node = createNode< Node >( role );
74 parent->appendChildNode( node );
79 template<
typename Node >
80 inline Node* ensureNode( QSGNode* node )
82 if ( node ==
nullptr )
85 return static_cast< Node*
>( node );
88 QSK_EXPORT
void resetGeometry( QSGGeometryNode* );