title: How to iterate a column in QTableWidget and check if a check box is checked?
body: <p>How can I iterate one column in <code>QTableWidget</code> and check if a checkbox is checked?</p>
  <p><a href="https://i.stack.imgur.com/HjgaS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HjgaS.jpg" alt="enter image description here" /></a></p>
  <p>When I clicked the button in the left, I want to iterate the column in the picture and check if a checkbox is checked.</p>
  <p>As of now, I've tried this function but the function only return <code>None</code>:</p>
  <pre class="lang-py prettyprint-override"><code>def checkBoxcheck(self):
      print(&quot;checkBoxcheck started&quot;)
      for row in range(self.rowCount()):
          print(self.cellWidget(1, 1))
          if not self.cellWidget(1, 1) is None:
              if self.cellWidget(row, 1).isChecked():
                  #others to do
  </code></pre>
  <p>This is the code to use in order to reproduce this problem (I already removed those unnecessary parts of the code):</p>
  <pre><code>from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QTableWidget, \
                          QTableWidgetItem, QVBoxLayout, QHBoxLayout
  from PyQt5.QtCore import Qt
  from PyQt5 import QtCore, QtWidgets
  import sys
  
  class TableWidget(QTableWidget):
      def __init__(self):
          super().__init__(10, 3)
          self.verticalHeader().setDefaultSectionSize(10)
          self.horizontalHeader().setDefaultSectionSize(200)
  
          for rows in range(self.rowCount()):
              item = QtWidgets.QTableWidgetItem()
              item.setCheckState(QtCore.Qt.Unchecked)
              self.setItem(rows, 1, item)
  
      def checkBoxcheck(self):
          print(&quot;checkBoxcheck started&quot;)
          for row in range(self.rowCount()):
              print(self.cellWidget(1, 1))
              if not self.cellWidget(1, 1) is None:
                  if self.cellWidget(row, 1).isChecked():
                      #others to do
                      pass
  
  
  class AppDemo(QWidget):
      def __init__(self):
          super().__init__()
          self.resize(700, 500)
  
          mainLayout = QHBoxLayout()
          table = TableWidget()
          mainLayout.addWidget(table)
          buttonLayout = QVBoxLayout()
  
          button_new = QPushButton('Check if checked')
          button_new.clicked.connect(table.checkBoxcheck)
          buttonLayout.addWidget(button_new)
  
          mainLayout.addLayout(buttonLayout)
          self.setLayout(mainLayout)
  
  def app():
      app = QApplication(sys.argv)
      demo = AppDemo()
      demo.show()
      sys.exit(app.exec_())
  
  app()
  </code></pre>
  <p>I hope you can help me with this problem</p>