def next_event(self, delete=False):
        if delete:
            msg = "Delete this event? This cannot be undone."
            msgbox = QMessageBox(QMessageBox.Question, 'Delete event', msg)
            msgbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
            msgbox.setDefaultButton(QMessageBox.Yes)
            response = msgbox.exec_()
            if response == QMessageBox.No:
                return
        event_sel = self.event_sel
        if event_sel is None:
            return
        notes = self.parent.notes
        if not self.current_event_row:
            row = notes.find_row(event_sel.marker.x(),
                            event_sel.marker.x() + event_sel.marker.width())
        else:
            row = self.current_event_row
        same_type = self.action['next_of_same_type'].isChecked()
        if same_type:
            target = notes.idx_annot_list.item(row, 2).text()
        if delete:            
            notes.delete_row()
            msg = 'Deleted event from {} to {}.'.format(event_sel.marker.x(), 
                            event_sel.marker.x() + event_sel.marker.width())
            self.parent.statusBar().showMessage(msg)
            row -= 1
        if row + 1 == notes.idx_annot_list.rowCount():
            return
        if not same_type:
            next_row = row + 1
        else:
            next_row = None
            types = notes.idx_annot_list.property('name')[row + 1:]
            for i, ty in enumerate(types):
                if ty == target:
                    next_row = row + 1 + i
                    break
            if next_row is None:
                return                
        self.current_event_row = next_row
        notes.go_to_marker(next_row, 0, 'annot')
        notes.idx_annot_list.setCurrentCell(next_row, 0)