title: QT SqlQueryModel, TreeView and SortFilterProxyModel how to get selected row
body: <p>I have a TreeView that is feeded by a SortFilterProxyModel that is feeded by a SqlQueryModel.</p>
  
  <p>Now I want to add double click event so that an edit dialog is loaded with data from the selected row and can be edited.</p>
  
  <p>But all I get is a "random" row to be loaded, it's like the TreeView current index is wrong. My guess is that the SortFilterProxyModel is messing it up, but I have no clue on how to get the right index.</p>
  
  <p>This is how I set my models:</p>
  
  <pre><code>proxyModel = new SortFilterProxyModel();
  
  treeView = new QTreeView();
  treeView-&gt;setModel(proxyModel);
  
  sqlModel = new QSqlQueryModel(this);
  proxyModel-&gt;setSourceModel(sqlModel);
  </code></pre>
  
  <p>And this is my code that gets the wrong row:</p>
  
  <pre><code>QSqlRecord product = sqlModel-&gt;record(treeView-&gt;currentIndex().row());
  </code></pre>
  
  <p>I'm a newbie on QT but I've looked everywhere on the net and couldn't find an answer, so I'm hoping someone here can help me! :D</p>