title: How to add a row in a PyQt5 in python using a button
body: <p>Getting confused here after trying for hours to find what I am missing, why this code is not adding rows after hitting the 'add row' button!!
  if I work on adding the rows without hitting the button it works fine(using <strong>init</strong> functions) but with the button use, it does not. </p>
  
  <pre><code>import sys
  from PyQt5.QtWidgets import *
  
  
  class TabWidget(QDialog):
      def __init__(self):
          super().__init__()
          self.table=AccountTable()
  
          self.setWindowTitle('Tab Widget Application')
  
          tabwidget = AccountTable()
          connectButton = QPushButton('add a row')
          connectButton.clicked.connect(self.onConnectButtonClicked)
          vbox=QVBoxLayout()
          vbox.addWidget(tabwidget)
          vbox.addWidget(connectButton)
          self.setLayout(vbox)
  
      def onConnectButtonClicked(self):
              self.table.add_trade(2)
  
  class AccountTable(QTableWidget):
      headerls = [
          'Capital $ Value', 'Capital-Trading $ Value', 'First-Trading $ Value', 'Second-Trading $ Value',
          'Time Elapsed',  'PNL', 'Capital $ Return', 'withdrawable $ ', 'Closing Date' ]
  
      def __init__(self, parent=None):
          QTableWidget.__init__(self, parent)
          self.setColumnCount(len(self.headerls))
          self.setHorizontalHeaderLabels(self.headerls)
          self.setAlternatingRowColors(True)
          self.resizeColumnsToContents()
  
  
  
      def add_trade(self,h):
              for i in range(h):
                  row = self.rowCount()
                  self.insertRow(row)
  
  
  if __name__ == '__main__':
      app=QApplication(sys.argv)
      tabwidget = TabWidget()
      tabwidget.show()
      app.exec()
  </code></pre>