title: Qt reimplement QSortFilterProxyModel::data() while model is using internalpointer()
body: <p>I have a written model (myModel) using <code>internalpointer()</code> for his <code>data()</code> implementation.
  I want to filter a tree (based on myModel) using <code>QSortFilterProxyModel</code>,</p>
  
  <p>I got it to work, only when i try to get any data from the tree my app crashes.</p>
  
  <p>I think its because while calling the tree data, expecting to get the myModel indexModel, i get the <code>myQSortFilterProxyModel</code> indexModel.</p>
  
  <pre><code>myItem *myModel::getItem(const QModelIndex &amp;index) const
  {
      if (index.isValid()) {
          myItem *item = static_cast&lt;myItem*&gt;(index.internalPointer());
          if (item) return item;
      }
      return rootItem;
  }
  </code></pre>
  
  <p>myModel <code>data()</code> using <code>internalPointer()</code></p>
  
  <pre><code>QVariant myModel::data(const QModelIndex &amp;index, int role) const
  {
      if (!index.isValid())
          return QVariant();
  
      if (role != Qt::DisplayRole &amp;&amp; role != Qt::EditRole)
          return QVariant();
  
      myItem *item = getItem(index);
  
      return item-&gt;data(index.column());
  }
  </code></pre>
  
  <p>setting the filter model between myModel ant the tree</p>
  
  <pre><code>void myTree::myInit()
  {
  ...
      myModel *model = new myModel();
      proxyModel = new mySortFilterProxyModel(this);
      proxyModel-&gt;setSourceModel(model);
      this-&gt;setModel(proxyModel);
  ...
  </code></pre>
  
  <p>myTree is QTreeView subclass.
  I want to use <code>tree-&gt;model()</code> to get myModel model</p>
  
  <p>how do I get the source model data?</p>