title: cpp Qt Model not updating QML view
body: <p>I am using a custom model for my <strong>QML view</strong> and I want to be able to move items thanks to a drag and drop.
  I use a list in my cpp model to set Data and then I just bind my model to the <code>QML view</code>.</p>
  
  <p>However, when I drop an item in a new position, <strong>the view ask the model to move the item on is new position</strong>.
  In that purpose, I just <strong>update my dataList</strong> with the function <code>dataList.move(oldIndexPosition, newIndexPosition)</code>.
  <strong>My dataList is correctly updated but it doesn't refresh the QML view</strong>.
  I tried to use the signal <code>emit dataChanged()</code>but it is still <strong>not refreshing the view</strong>. </p>
  
  <p>I don't understand what should I do, any suggestion ?</p>
  
  <p>Here is a simple example of what I try to do. Notice that there is no drag and drop here, in order to make it easier to understand:</p>
  
  <pre><code>public:
      Q_INVOKABLE void move(int oldIndex, int newIndex) {
                dataList.move(oldIndex,newIndex);
                emit dataChanged(this-&gt;index(oldIndex),this-&gt;index(newIndex));
      }
  
  signals:
      void dataChanged(const QModelIndex &amp; topLeft, const QModelIndex &amp; bottomRight);
  </code></pre>
  
  <p><em>model.h</em></p>
  
  <pre><code>int main(int argc, char ** argv)
  {
      QGuiApplication app(argc, argv);
  
      Model model;
      model.addSomeData("data1");
      model.addSomeData("data2");
      model.addSomeData("data3");
  
      QQuickView view;
      view.setResizeMode(QQuickView::SizeRootObjectToView);
      QQmlContext *ctxt = view.rootContext();
      ctxt-&gt;setContextProperty("myModel", &amp;model);
  
      view.setSource(QUrl("qrc:view.qml"));
      view.show();
  
      return app.exec();
  }
  </code></pre>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>ListView {
      width: 200; height: 250
  
      model: myModel
      delegate: Text { text: "data " + data  }
  
      MouseArea {
          anchors.fill: parent
          cursorShape: Qt.PointingHandCursor
          onClicked: {
              myModel.move(0,2) //Just a test
          }
      }
  }
  </code></pre>
  
  <p><em>myqml.qml</em></p>
  
  <p>If you have any idea of what I am doing wrong, that would be really kind of you to help me! Thank you very much.</p>