(self)
return res
Encode and return the current state as a CategoriesMappingType
Encode and return the current state as a CategoriesMappingType
Encode and return the current state as a CategoriesMappingType
def __categories_mapping(self):
        # type: () -> CategoriesMappingType
        """
        Encode and return the current state as a CategoriesMappingType
        """
        model = self.values_model
        source = self.var.categories

        res = []  # type: CategoriesMappingType
        for i in range(model.rowCount()):
            midx = model.index(i, 0)
            category = midx.data(Qt.EditRole)
            source_pos = midx.data(SourcePosRole)  # type: Optional[int]
            if source_pos is not None:
                source_name = source[source_pos]
            else:
                source_name = None
            state = midx.data(EditStateRole)
            if state == ItemEditState.Dropped:
                res.append((source_name, None))
            elif state == ItemEditState.Added:
                res.append((None, category))
            else:
                res.append((source_name, category))
        return res
def __categories_mapping ( self ) : # type: () -> CategoriesMappingType model = self . values_model source = self . var . categories res = [ ] # type: CategoriesMappingType for i in range ( model . rowCount ( ) ) : midx = model . index ( i , 0 ) category = midx . data ( Qt . EditRole ) source_pos = midx . data ( SourcePosRole ) # type: Optional[int] if source_pos is not None : source_name = source [ source_pos ] else : source_name = None state = midx . data ( EditStateRole ) if state == ItemEditState . Dropped : res . append ( ( source_name , None ) ) elif state == ItemEditState . Added : res . append ( ( None , category ) ) else : res . append ( ( source_name , category ) ) return res