code: def removeComponent(self, index):
          
          if index.row() ==  self.rowCount() -1  and self.columnCountForRow(index.row()) == 1:
              self.beginRemoveRows(QtCore.QModelIndex(), self._stim.rowCount()-1, 
                                   self._stim.rowCount()-1)
              self._stim.removeComponent(index.row(), index.column())
              self.endRemoveRows()
          else:
              self._stim.removeComponent(index.row(), index.column())
  
          # this could have affected the sample of this stimulus
          self.samplerateChanged.emit(self._stim.samplerate())
docs: Removes the component at *index* from the model. If the two last
          rows are now empty, trims the last row.