[Interest] Return null QSGNode from updatePaintNode to erase previously drawn things

Gunnar Sletta gunnar at sletta.org
Wed May 11 12:09:42 CEST 2016


Sounds perfectly normal :)

The node you return from updatePaintNode is the visual representation of that given item, excluding that item's children. Returning null for it will remove that item from the scene (and you should delete the node since the SG no longer holds a reference to it or any of its children), but does not affect that item's children. As the scene graph is a tree, removing the paint node will of course remove any child nodes of the removed paint node also.

The child items of a QQuickItem can be thought of as siblings to its paint node and their visibility can be controlled via QQuickItem::setVisible() or through their own updatePaintNode calls. 

cheers,
Gunnar

> On 11 May 2016, at 11:42, Данил Патрушев <dannix84 at gmail.com> wrote:
> 
> Hi all. I have a quick item which does some custom drawing and has a few visible child items. At some point I want to erase all the stuff drawn by this item, which I thought I could by returning a null qsgnode from updatePaintNode, but the stuff remains visible. I have a few ideas how to work around this, but I just wonder if this is considered normal behavior.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list