title: QML TreeView items are not updated when emitting dataChanged
body: <p>I have a QML <code>TreeView</code> like this:</p>
  
  <pre><code>  TreeView
    {
      id: treeview
      model: myModel
      anchors.fill: parent
      alternatingRowColors: false
      headerVisible: false
  
      TableViewColumn
      {
        title: "Name"
        role: "name"
        delegate: Text
        {
        text: styleData.value
        }
      }
  </code></pre>
  
  <p>However, when I emit dataChanged from a custom method in C++, nothing is updated:</p>
  
  <pre><code>void MyModel::NameChanged()
  {
    // beginResetModel(); &lt;=== Works
    // endResetModel();
  
    // emit dataChanged(QModelIndex(), QModelIndex()); // Does not work
  
    auto topLeftIndex = createIndex(0, 0, m_root.get());
    auto bottomRightIndex = createIndex(rowCount(), columnCount(), m_root.get());
    (( emit dataChanged(topLeftIndex, bottomRightIndex);  // Does not work.
    emit dataChanged(topLeftIndex, topLeftIndex);  // Does not work.
  }
  </code></pre>
  
  <p>In QML, <code>text</code> is bound to <code>styleData.value</code> and I am not setting text anywhere else. Also, dataChanged is not redefined elsewhere. So I am sure I am really emitting <code>QAbstractItemModel::dataChanged(...)</code>.</p>
  
  <p>Any idea what I am doing wrong?</p>
  
  <p>My index method:</p>
  
  <pre><code>QModelIndex index(int row, int column, const QModelIndex &amp;parentIdx) const
  {
    if (hasIndex(row, column, parentIdx) == false)
    {
      return QModelIndex();
    }
  
    auto parentItem = m_root.get();
    if (parentIdx.isValid() == true)
    {
      parentItem = static_cast&lt;ModelItem *&gt;(parentIdx.internalPointer());
    }
  
    auto childItem = parentItem-&gt;GetChild(row);
    auto childName = childItem-&gt;GetName().toStdString();
    if (childItem)
    {
      auto index = createIndex(row, column, childItem.get());
      return index;
    }
    else
    {
      return QModelIndex();
    }
  }
  </code></pre>
  
  <p>My parent method:</p>
  
  <pre><code>QModelIndex parent(const QModelIndex &amp;childIndex) const
  {
    if (childIndex.isValid() == false)
    {
      return QModelIndex();
    }
  
    auto childItem = static_cast&lt;ModelItem*&gt;(childIndex.internalPointer());
    auto parentItem = childItem-&gt;GetParent();
  
    if (parentItem.expired() == true)
    {
      return QModelIndex();
    }
  
    auto pItem = parentItem.lock();
    if (pItem == nullptr)
    {
      return QModelIndex();
    }
  
    auto parentIndex = createIndex(pItem-&gt;GetRow(), 0, pItem.get());
    return parentIndex;
  }
  </code></pre>
  
  <p><strong>UPDATE: if I use my model in C++ using a QTreeView, then it works.</strong></p>