title: Selecting a row in QTreeView programmatically
body: <p>I have a QTreeView with QFileSystemModel as model.</p>
  
  <p>The QTreeView has SelectionBehavior set to SelectRows.</p>
  
  <p>In my code I read a dataset to select and then select them via: </p>
  
  <pre><code>idx = treeview-&gt;model()-&gt;index(search); 
  selection-&gt;select(idx, QItemSelectionModel::Select);
  </code></pre>
  
  <p>This selects a cell, not the row . . </p>
  
  <p>Have added a stupid workaround, but would rather fix this the correct way.</p>
  
  <pre><code>for (int col=0; col&lt; treeview-&gt;model()-&gt;columnCount(); col++) 
  { 
     idx = treeview-&gt;model()-&gt;index(search, col); 
     selection-&gt;select(idx, QItemSelectionModel::Select); 
  } 
  </code></pre>
  
  <p>Or is that ^^ the only way to do it?</p>