title: How can I style the cells of a QTableWidget in PyQt5?
body: <p>I'm new to Qt and PyQt and wonder how to style the cells of a QTableWidget. For example, I want to add some etxra padding. I tried to set a stylesheet like in the code below, but it doesn't have any effect. I also searched the internet, but couldn't find a solution.</p>
  <p>I use PyQT5 (python-pyqt5 5.15.4-1 on Arch Linux).</p>
  <p>This is my code:</p>
  <pre><code>import sys
  
  from PyQt5.QtWidgets import QApplication,QMainWindow, QTableWidget, QTableWidgetItem
  
  
  class MainWindow(QMainWindow):
      def __init__(self):
          super().__init__()
          self.setWindowTitle('Table Test')
          table = QTableWidget(self)
          table.setColumnCount(4)
          table.setRowCount(3)
          for j in range(table.rowCount()):
              for k in range(table.columnCount()):
                  table.setItem(j, k, QTableWidgetItem(&quot;{}{}&quot;.format(j, k)))
          self._centralWidget = table
          self.setCentralWidget(self._centralWidget)
          self.resize(500, 200)
  
  
  def main():
      app = QApplication(sys.argv)
      view = MainWindow()
      view.setStyleSheet(&quot;QTableWidget::item {padding: 5px}&quot;)
      view.show()
      sys.exit(app.exec_())
  
  
  if __name__ == '__main__':
      main()
  </code></pre>
  <p>Can anybody please help?</p>