(self)
Add a new category
Add a new category
Add a new category
def _add_category(self):
        """
        Add a new category
        """
        view = self.values_edit
        model = view.model()

        with disconnected(model.dataChanged, self.on_values_changed,
                          Qt.UniqueConnection):
            row = model.rowCount()
            if not model.insertRow(model.rowCount()):
                return
            index = model.index(row, 0)
            model.setItemData(
                index, {
                    Qt.EditRole: "",
                    SourcePosRole: None,
                    EditStateRole: ItemEditState.Added
                }
            )
            view.setCurrentIndex(index)
            view.edit(index)
        self.on_values_changed()
def _add_category ( self ) : view = self . values_edit model = view . model ( ) with disconnected ( model . dataChanged , self . on_values_changed , Qt . UniqueConnection ) : row = model . rowCount ( ) if not model . insertRow ( model . rowCount ( ) ) : return index = model . index ( row , 0 ) model . setItemData ( index , { Qt . EditRole : "" , SourcePosRole : None , EditStateRole : ItemEditState . Added } ) view . setCurrentIndex ( index ) view . edit ( index ) self . on_values_changed ( )