title: Adding data to QTableWidget using PyQt4 in Python
body: <p>I want to add my data to a table using pyqt in python. I found that I should use <code>setItem()</code> function to add data to a <code>QTableWidget</code> and give it the row and column number and a <code>QTableWidgetItem</code>. I did it but when I want to display the table, it's completely empty.
  Maybe I made a silly mistake but please help me.
  Here is my code: </p>
  
  <pre><code>from PyQt4 import QtGui
  
  class Table(QtGui.QDialog):
      def __init__(self, parent=None):
          super(Table, self).__init__(parent)
          layout = QtGui.QGridLayout() 
          self.led = QtGui.QLineEdit("Sample")
          self.table = QtGui.QTableWidget()
          layout.addWidget(self.led, 0, 0)
          layout.addWidget(self.table, 1, 0)
          self.table.setItem(1, 0, QtGui.QTableWidgetItem(self.led.text()))
          self.setLayout(layout)
  
  if __name__ == '__main__':
      import sys
      app = QtGui.QApplication(sys.argv)
      t = Table()
      t.show()
      sys.exit(app.exec_())
  </code></pre>