title: Using QSqlQuery and table view
body: <p>I am trying add basic search functionality to my project so I created a search bar and a search button, when said button is clicked I want to query a database and display the results on a table view widget.</p>
  
  <p>However I still don't quite understand how to add data to the table, I tried creating a QsqlQuery and using the setQuery method of the table widget, but when I click the search button nothing happens.
  What am I doing wrong?</p>
  
  <p>Here is my code.</p>
  
  <pre><code>def searchEvent(self):
    '''
    Send appropriate search query and display results on the tableView
    '''
    # Connect to the database
    db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
    db.setDatabaseName("data.sqlite3")
    db.open()
  
    # Prepare query
    query = QtSql.QSqlQuery(db)
    query.prepare("SELECT * FROM SetInfo_view WHERE Name LIKE(?)")
    query.bindValue(0, self.searchLineEdit.text())
  
    # Prepare table model
    tableModel = QtSql.QSqlQueryModel()
    tableModel.setQuery(query)
    self.tableView.setModel(tableModel)
    self.tableView.show()
    db.close()
  </code></pre>
  
  <p>Thanks in advance.</p>