title: Periodically redraw QQuickItem
body: <p>I have created a custom QML Element by extending QQuickItem and overriding the updatePaintNode() function.</p>
  
  <p>Since I need to draw rectangles along a timeline which will grow in real-time I need the GUI to be redrawn for every new frame. </p>
  
  <p>Is there a way to have the updatePaintNode() function be executed periodically for every new frame?</p>
  
  <p>I have tried calling <code>node-&gt;markDirty(QSGNode::DirtyForceUpdate)</code> which did not cause the updatePaintNode() function to be called periodically.</p>
  
  <p><strong>Edit: this is what my code looks like:</strong></p>
  
  <pre><code>QSGNode *PianoRoll::updatePaintNode(QSGNode *n, QQuickItem::UpdatePaintNodeData *data)
  {
      QSGGeometryNode *node = static_cast&lt;QSGGeometryNode *&gt;(n);
      if (!node)
      {
          node = new QSGSimpleRectNode(boundingRect(), Qt::white);
      }
  
      node-&gt;removeAllChildNodes();
  
      qreal msPerScreen = 10000;
      qreal pitchesPerScreen = 128;
      qreal x_factor = (qreal) boundingRect().width() / msPerScreen;
      qreal y_factor = (qreal) boundingRect().height() / pitchesPerScreen;
  
      for (unsigned int i = 0; i &lt; m_stream-&gt;notes.size(); i++)
      {
          shared_ptr&lt;Note&gt; note = m_stream-&gt;notes.at(i);
          qreal left = boundingRect().left() + note-&gt;getTime() * x_factor;
          qreal top = boundingRect().top() + note-&gt;getPitch() * y_factor;
          qreal width;
          qreal height = y_factor;
  
          if (note-&gt;getDuration() != 0)
          {
              width = note-&gt;getDuration() * x_factor;
          }
          else
          {
              // TODO
              width = 500 * x_factor;
  
          }
  
          QRectF noteRectangle = QRectF(left, top, width, height);
          node-&gt;appendChildNode(new QSGSimpleRectNode(noteRectangle, Qt::black));
      }
      node-&gt;markDirty(QSGNode::DirtyForceUpdate);
      return node;
  }
  </code></pre>