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

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

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

Methods

impl<T> SGNode<T>[src]

pub unsafe fn from_raw(raw: *mut c_void) -> Self[src]

pub fn into_raw(self) -> *mut c_void[src]

"leak" the QSGNode* pointer, so the caller must take ownership

pub fn reset(&mut self)[src]

impl SGNode<ContainerNode>[src]

pub fn update_dynamic<T: Any, Iter: ExactSizeIterator, F>(
    &mut self,
    iter: Iter,
    f: F
) where
    F: FnMut(<Iter as Iterator>::Item, SGNode<T>) -> SGNode<T>, 
[src]

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.

// 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
 }

pub fn update_static<A: 'static, T: UpdateNodeFnTuple<A>>(&mut self, info: T)[src]

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

// 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
 }

impl SGNode<RectangleNode>[src]

pub fn set_color(&mut self, color: QColor)[src]

pub fn set_rect(&mut self, rect: QRectF)[src]

pub fn create(&mut self, item: &dyn QQuickItem)[src]

impl SGNode<TransformNode>[src]

pub fn set_translation(&mut self, x: f64, y: f64)[src]

pub fn create(&mut self)[src]

pub fn update_sub_node<F: FnMut(SGNode<ContainerNode>) -> SGNode<ContainerNode>>(
    &mut self,
    f: F
)
[src]

Trait Implementations

impl<T> Drop for SGNode<T>[src]

fn drop(&mut self)[src]

Destroy the SGNode*

Auto Trait Implementations

impl<T> !Send for SGNode<T>

impl<T> !Sync for SGNode<T>

impl<T> Unpin for SGNode<T> where
    T: Unpin

impl<T> UnwindSafe for SGNode<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for SGNode<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]