title: Null values in qtablewidget
body: <p>I develop a desktop application on PYQT5 with integration of posgtresql. I stumbled over the situation that the table does not display the values:</p>
  
  <p><img src="https://i.stack.imgur.com/Y5Mir.png" alt="looks like on screen"></p>
  
  <p>source code: </p>
  
  <pre><code>def createTable(self):
      self.tableWidget = QTableWidget()
  
      conn = psycopg2.connect('host=localhost port=5432 dbname=postgres user=postgres password=12345678')
  
      cursor = conn.cursor()
      query = cursor.execute("SELECT * FROM wave_params")
      result = cursor.fetchall()
      for i in result:
          print(i)
  
      rows = len(result)
      columns = len(result[0])
      self.tableWidget.setColumnCount(columns)
      self.tableWidget.setRowCount(rows)
  
      index = 0
      while query != None:
          self.tableWidget.setItem(index,0, QTableWidgetItem(query.result[0]))
          # self.tableWidget.setItem(index, 1, QTableWidgetItem(str(query.value(1))))
          # self.tableWidget.setItem(index, 2, QTableWidgetItem(str(query.value(2))))
          index = index + 1
  
  
  
      # table selection change
      self.tableWidget.doubleClicked.connect(self.on_click)
  
  @pyqtSlot()
  def on_click(self):
      print("\n")
      for currentQTableWidgetItem in self.tableWidget.selectedItems():
          print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
  </code></pre>
  
  <p>I can not understand. what is the problem?
  Thanks!</p>