title: Qt Model/View: setRootIndex on a proxy model fails
body: <p>I have a tree model class that inherits <code>QAbstractItemModel</code> (let's say <code>Model</code>) and two filter proxy models inheriting <code>QSortFilterProxyModel</code>. Both proxy models are set on the same model instance:</p>
  
  <pre><code>m_groupFilter-&gt;setSourceModel(m_model);
  m_parameterFilter-&gt;setSourceModel(m_model);
  </code></pre>
  
  <p>and these filters are set on two <code>QTreeView</code>s on UI:</p>
  
  <pre><code>ui-&gt;treeViewGroups-&gt;setModel(m_groupFilter);
  ui-&gt;treeViewParameters-&gt;setModel(m_parameterFilter);
  </code></pre>
  
  <p>Now, I want to <code>setRootIndex()</code> of the second view, to the selected item from first one. Connecting signals and so on I do this:</p>
  
  <pre><code>QModelIndex actualIndex = m_groupFilter-&gt;mapToSource(index);
  QModelIndex mappedIndex = m_parameterFilter-&gt;mapFromSource(actualIndex);
  qDebug() &lt;&lt; mappedIndex.isValid();
  qDebug() &lt;&lt; ui-&gt;treeViewParameters-&gt;model();
  qDebug() &lt;&lt; mappedIndex.model();
  ui-&gt;treeViewParameters-&gt;setRootIndex(mappedIndex);
  </code></pre>
  
  <p>Above code fails with this output and a warning:</p>
  
  <pre><code>true
  ConfigurationParameterFilterModel(0x43d190)
  ConfigurationParameterFilterModel(0x43d190)
  QAbstractItemView::setRootIndex failed : index must be from the currently set model
  QAbstractItemView::setRootIndex failed : index must be from the currently set model
  </code></pre>
  
  <p>I can see that this only happens when models of input index for <code>setRootIndex</code> and the object calling <code>setRootIndex</code> on, differ (which is not the case here) or index is invalid (which is neither the case here). Following is the <a href="https://github.com/qt/qtbase/blob/3a569573b2b8e8dc56f0a152afcb48723b682ba8/src/widgets/itemviews/qabstractitemview.cpp#L1143" rel="nofollow noreferrer">Qt source code that generates the warning</a> :</p>
  
  <pre><code>void QAbstractItemView::setRootIndex(const QModelIndex &amp;index)
  {
      Q_D(QAbstractItemView);
      if (Q_UNLIKELY(index.isValid() &amp;&amp; index.model() != d-&gt;model)) {
          qWarning("QAbstractItemView::setRootIndex failed : index must be from the currently set model");
          return;
      }
      d-&gt;root = index;
      d-&gt;doDelayedItemsLayout();
      d-&gt;updateGeometry();
  }
  </code></pre>
  
  <p>So why it's not working?</p>