code: def setFlag(self, flag, state=True):
          
          if state:
              self.setFlags(self.flags() | flag)
          else:
              self.setFlags(self.flags() & ~flag)
docs: Sets whether or not the inputed flag is associated with this item.
          
          :param      flag  | <QtCore.Qt.ItemFlags>
                      state | <bool>