Struct qmetaobject::scenegraph::SGNode[][src]

#[repr(C)]
pub struct SGNode<T> { pub raw: *mut c_void, // some fields omitted }
Expand description

A typed node in the scene graph

the SGNode owns a QSGNode* of a given type. The type information is given by T which is a Tag type (an empty enum)

Fields

raw: *mut c_void

Implementations

“leak” the QSGNode* pointer, so the caller must take ownership

Update the child nodes from an iterator.

When calling this function, all child nodes must be of the same type, but the amount of node must not be known at compile time.

The array must have the same size every time the function is called on the node. (panic otherwise). call reset() if you want to change the size.

use qmetaobject::scenegraph::{SGNode, ContainerNode, RectangleNode};
use qttypes::QRectF;

// in the reimplementation of  QQuickItem::update_paint_node
fn update_paint_node(&mut self, mut node: SGNode<ContainerNode>) -> SGNode<ContainerNode> {
   let items: &Vec<QRectF> = &self.items;
   node.update_dynamic(items.iter(),
       |i, mut n| -> SGNode<RectangleNode> {
           n.create(self);
           n.set_rect(*i);
           n
       });
   node
 }

Update the child node: given a tuple of update function, runs it for every node

The argument is a tuple of update functions. The same node types must be used every time this function is called. (If reset() was not called in between) (Panic otherwise). Each node type can be different.

In this example, the node has two children node

use qmetaobject::scenegraph::{SGNode, ContainerNode, RectangleNode};
use qttypes::QRectF;

// in the reimplementation of  QQuickItem::update_paint_node
fn update_paint_node(&mut self, mut node : SGNode<ContainerNode> ) -> SGNode<ContainerNode> {
     node.update_static((
         |mut n : SGNode<RectangleNode>| -> SGNode<RectangleNode> {
             n.create(self);
             n.set_rect(QRectF { x: 0., y: 0., width: 42., height: 42. });
             n
         },
         |mut n : SGNode<RectangleNode>| -> SGNode<RectangleNode> {
             n.create(self);
             n.set_rect(QRectF { x: 0., y: 0., width: 42., height: 42. });
             n
         }));
     node
 }

Trait Implementations

Destroy the SGNode*

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.