title: PyQt4 Selected Item Text in QTableView delayed by one click
body: <p>I'm using a <code>QTableView</code> to display contents of a <code>QSqlTableModel</code> along with using a <code>QSortFilterProxyModel</code> to filter the records. In the following code I've managed to get the selected text to be displayed when a user clicks the cell (regardless if a filter is applied or not). However, it is always 1 click behind, the first click after start causes an <code>IndexError: pop from empty list</code> and when a new column is selected within the same row nothing happens.</p>
  
  <p>I've tried selecting an index after I initialize the table, didn't seems to do anything. I'm out of ideas of what to try next?</p>
  
  <pre class="lang-py prettyprint-override"><code>class TableViewer(QtGui.QWidget):
  
      self.model =  QSqlTableModel()
      self._proxyModel = QtGui.QSortFilterProxyModel()
      self._proxyModel.setSourceModel(self.model)
  
      self.tv= QTableView()
      self.tv.setModel(self._proxyModel)
  
     '''Call-able filter - pass in string to filter everything that doesn't match string'''
      QtCore.QObject.connect(self.textEditFilterBox,  QtCore.SIGNAL("textChanged(QString)"),     self._proxyModel.setFilterRegExp)
  
  
       def getItem(self):
           '''Retruns item text of selected item'''
           index = self.selectionModel.selectedIndexes().pop()
           if index.isValid():
               row = index.row()
               column = index.column()
               model = index.model()
               if hasattr(model, 'mapToSource'):
                   #proxy model
                   modelIndex = model.mapToSource(index)
                   print (modelIndex.row(), modelIndex.column())
                   return self.model.record(modelIndex.row()).field(modelIndex.column()).value().toString()
           return self.model.record(row).field(column).value().toString()
  
  class MainWindow(QtGui.QMainWindow):
  
      #initialize TableViewer
  
      self.tblViewer.connect(self.tblViewer.tv.selectionModel(),
              SIGNAL(("currentRowChanged(QModelIndex,QModelIndex)")),
              self.tblItemChanged)
  
      def tblItemChanged(self, index):
          '''display text of selected item '''
          text = self.tblViewer.getItem()
          print(text)
  </code></pre>