title: PyQt: select row in QTreeView programmatically and emit signals
body: <p>I was looking to select a row in a QTreeView programmatically, and I found 95% of the answer <a href="https://stackoverflow.com/questions/4967660/selecting-a-row-in-qtreeview-programatically/40613097#40613097">here</a>.</p>
  
  <p>The <code>select()</code> method does the job perfectly, except that it doesn't seem to trigger any of the events of clicking on the view.</p>
  
  <p>I found a workaround by calling the needed signal myself - but are there any hints of a method that would emulate a human click and send all the signals associated?</p>
  
  <p>Here's my workaround (in Python) :</p>
  
  <pre><code>oldIndex=treeView.selectionModel().currentIndex()
  newIndex=treeView.model().indexFromItem(item)
  #indexes stored----------------------------------
  treeView.selectionModel().select(
      newIndex,
      QtGui.QItemSelectionModel.ClearAndSelect)
  #selection changed-------------------------------
  treeView.selectionModel().currentRowChanged.emit(
      newIndex,
      oldIndex)
  #signal manually emitted-------------------------
  </code></pre>