title: Triggering QML animation for property changes
body: <p>I'm implementing an app with some CPU intensive code. This code must update the interface designed in QML to display its results.</p>
  
  <p>The interface is made of a grid and a few blocks with some contents inside. The <code>Grid</code> is fully C++ implemented, and the <code>Block</code> is only QML.</p>
  
  <p><code>Block.qml</code></p>
  
  <pre><code>import QtQuick 2.3
  
  Item {
      id: root
  
      // lot of non-related stuff here.
  
      Behavior on x {
          NumberAnimation {
              duration: 1000
              easing.type: Easing.Linear
  
              onRunningChanged: {
                  console.log("behavior on x");
              }
          }
      }
  
      Behavior on y {
          NumberAnimation {
              duration: 1000
              easing.type: Easing.Linear
  
              onRunningChanged: {
                  console.log("behavior on y");
              }
          }
      }
  }
  </code></pre>
  
  <p>Each of the blocks are created in C++ and positioned accordingly.</p>
  
  <p>The problem is that some times I must move the blocks and I would like to trigger an animation. To accomplish this I've included the <code>Behavior</code> elements as you have probably noticed.</p>
  
  <p>But when I change the position of the block from C++ code, the behavior is not triggered. The <code>Block</code> simply changes its position, without any animation.</p>
  
  <p>The code I'm using to change the block position is:</p>
  
  <pre><code>void Grid::setBlockPosition(QQuickItem *block, unsigned i, unsigned j)
  {
      float x, y;
      x = GRID_MARGIN_LEFT + j * this-&gt;_blockSize;
      y = GRID_MARGIN_TOP + (GRID_ROWS - i - 1) * this-&gt;_blockSize;
      block-&gt;setPosition(QPointF(x, y));
  }
  </code></pre>
  
  <p>I've tried also changing <code>x</code> and then <code>y</code> instead of changing both at the same time, but it gave the same result.</p>
  
  <p>How can I trigger the behavior on <code>x</code> and <code>y</code> properties from C++?</p>