title: How use QSortFilterProxyModel in database?
body: <p>I have a QTableWidget with data from database and I want to search its content in real time (when I'm typing a letter he show me results)? Every help is welcome. Thanks a lot.</p>
  
  <p>This is my code:</p>
  
  <pre><code>class Filter:
      def __init__(self):
          object.__init__(self)
          self.db = QtSql.QSqlDatabase.addDatabase('QSQLITE')
          self.db.setDatabaseName("baza.db")
          self.filter_model= QSortFilterProxyModel()
  
  
  
      def sqlPodaci(self,okvir):
          okvir.setObjectName("Okvir aplikacije")
          okvir.resize(700,320)
          line_edit = QLineEdit(okvir)
          line_edit.setGeometry(20, 20, 205, 23)
          self.tableWidget = QtWidgets.QTableWidget(okvir)
          self.tableWidget.setGeometry(QtCore.QRect(20, 50, 620, 201))
          self.tableWidget.setAlternatingRowColors(True)
          self.tableWidget.setRowCount(3)
          self.tableWidget.horizontalHeader().setVisible(True)
          self.tableWidget.verticalHeader().setVisible(False)
  
          ###
          self.filter_model.setFilterKeyColumn(1)
          line_edit.textChanged.connect(self.filter_model.setFilterRegExp)
          ####
          self.Ucitavanje_podataka()
  </code></pre>
  
  <p>This is the code for reading data from the database:</p>
  
  <pre><code>def Ucitavanje_podataka(self):
  
  status = self.db.open()
  if status == False:
      QtWidgets.QMessageBox.warning(self, "Error", self.db.lastError().text(), QtWidgets.QMessageBox.Discard)
  else:
      self.tableWidget.setColumnCount(6)
      self.tableWidget.setHorizontalHeaderLabels(['Id','Ime','Prezime','Godine','Adresa','Plata'])
  
      row = 0
      sql = " SELECT * FROM Zaposleni"
      query = QtSql.QSqlQuery(sql)
      while query.next():
          self.tableWidget.insertRow(row)
          ID=QtWidgets.QTableWidgetItem(str(query.value(0)))
          Ime = QtWidgets.QTableWidgetItem(str(query.value(1)))
          Prezime = QtWidgets.QTableWidgetItem(str(query.value(2)))
          Godine = QtWidgets.QTableWidgetItem(str(query.value(3)))
          Adresa = QtWidgets.QTableWidgetItem(str(query.value(4)))
          Plata = QtWidgets.QTableWidgetItem(str(query.value(5)))
  
          self.tableWidget.setItem(row,0,ID)
          self.tableWidget.setItem(row, 1, Ime)
          self.tableWidget.setItem(row, 2, Prezime)
          self.tableWidget.setItem(row, 3, Godine)
          self.tableWidget.setItem(row, 4, Adresa)
          self.tableWidget.setItem(row, 5, Plata)
          row=row+1
  </code></pre>