title: How to print a QTableView
body: <p>I have a Python and PySide app that connects to a mysql database and displays the results of a query in a QTableView. 
  I need to print the contents of the table view.
  Here's some code:</p>
  
  <pre><code>    self.db_table = QtGui.QTableView(self)
      self.model =  QtSql.QSqlQueryModel()
      self.model.setQuery("SELECT * FROM simpsons")
      self.model.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("First Name"))
      self.model.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Last Name"))
      self.db_table.setModel(self.model) 
  
      self.print_btn = QtGui.QPushButton("Print")
      self.print_btn.clicked.connect(self.print_btn_clicked)
  
      def print_btn_clicked(self):
          printDialog = QtGui.QPrintDialog(self.printer, self)
          if printDialog.exec_() == QtGui.QDialog.Accepted:
           #printing code
  </code></pre>
  
  <p>I can't find an example for this and I don't understand much from the documentation so I'd appreciate some help</p>