How to disable updatePaintNode on a QQuickItem at will

  • I have a QQuickItem derived class

    // Class
    class MyQQuickItem : public QQuickItem {
    // updatePaintNode in cpp function
    QSGNode * MyQQuickItem::updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData) {
      // draw UI logic
      return node;
    // QML component
    MyQQuickItem {
      id: my_quick
      objectName: "myquickitem"
      width : 500
      height : 500

    I am doing something on a separate UI which causes the updatePaintNode of MyQQuickItem to be fired. If I have a pointer to MyQQuickItem on cpp side like so,

    QQuickItem * my_quick_item_ptr = m_qml_engine->rootObjects()[0]->findChild<QQuickItem*>("myquickitem");

    How can disable MyQQuickItem's updatePaintNode from getting called when I don't want it to?
    Secondary question: If yes, How to reinstate it back again?

  • Lifetime Qt Champion


    What about just setting the visible property to false ?

  • @SGaist I am taking MyQQuickItem & rendering it off screen on a QQuickRenderControl to run some algorithms & do other stuff. To render MyQQuickItem I am setting its parent using SetParentitem to my off screen window. For this work properly, I need MyQQuickItem to not update itself & stay visible.

    Hence making visible false is not an option for me. Any other way to block the updatePaintNode call?

  • Lifetime Qt Champion

    So some kind of boolean property Q_PROPERTY (e.g. renderingEnabled) that you would check at rendering time to know if you should do anything ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.