title: PyQt - QTableView doesn't respond dataChanged signal?
body: <p><code>QSqlQueryModel</code> is a great database model, but it is read only. So I rewrite its <code>setData()</code> and <code>flags()</code> method. Now, I can edit my database table from <code>QTableView</code></p>
  
  <p>But QTableView won't refresh itself when I emited a <code>dataChanged()</code>, when I edited a textbox in the <code>QTableView</code> and clicked somewhere else, the new value wrote into the database successfully, but the value of the textbox reverted to the old value. I have to re-select the whole table, got really bad performance...</p>
  
  <p>Why?</p>
  
  <pre><code>class StudentsTableModel(QtSql.QSqlQueryModel):
      def __init__(self):
          QtSql.QSqlQueryModel.__init__(self)
          self.LockedColumns = []
  
      def flags(self, index):
          flags = QtSql.QSqlQueryModel.flags(self, index)
          if index.column() not in self.LockedColumns:
              flags |= QtCore.Qt.ItemIsEditable
          return flags
  
      def setData(self, index, value, role):
          primary_key_index = self.index(index.row(), 0)
          name = self.data(primary_key_index)
          field = self.record().fieldName(index.column())
          self.update(name, field, value)
  
          self.dataChanged.emit(self.index, self.index)
  
          # Why DataView isn't refresh automatically when
          # a dataChanged signal emited? Force re-select...
          self.select(self.week)
  
          return True
  
      def update(self, name, field, value):
          query = QtSql.QSqlQuery()
          sql = ("UPDATE student_info SET '%s' = '%s' WHERE 学生姓名 = '%s'"
                  % (field, value, name))
          query.exec(sql)
  
      def select(self, week):
          self.week = week
          sql = ("SELECT 学生姓名,第%s周,小组 FROM student_info" % (week))
          self.setQuery(sql)
  </code></pre>