Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to disable updatePaintNode on a QQuickItem at will
Forum Updated to NodeBB v4.3 + New Features

How to disable updatePaintNode on a QQuickItem at will

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Roby BrundleR Offline
    Roby BrundleR Offline
    Roby Brundle
    wrote on last edited by
    #1

    I have a QQuickItem derived class

    // Class
    class MyQQuickItem : public QQuickItem {
      Q_OBJECT
    }
    
    // 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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What about just setting the visible property to false ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Roby BrundleR 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What about just setting the visible property to false ?

        Roby BrundleR Offline
        Roby BrundleR Offline
        Roby Brundle
        wrote on last edited by
        #3

        @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?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Luan Nguyen
            wrote on last edited by
            #5

            Hi Roby Brundle,
            I have the same problem.
            I also want to disable seft update for exist QQuickItem.
            Did you found the solution yet?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved