code: def toggleModelIndex(self, modelIndex):
          
          if not self.isCheckable():
              return
              
          item = self.model().item(modelIndex.row())
          if item.checkState() == Qt.Checked:
              state = Qt.Unchecked
          else:
              state = Qt.Checked
          
          item.setCheckState(state)
docs: Toggles the index's check state.
          
          :param      modelIndex | <QModelIndex>