def createEditor(self, parent, option, index): if len(self._view.selectedIndexes()) > 1: self._selected_indexes = self._view.selectedIndexes() columns = index.model().get_git_model().get_columns() field_name = columns[index.column()] if field_name in TEXT_FIELDS: editor = QTextEdit(parent) elif field_name in ACTOR_FIELDS: editor = QLineEdit(parent) elif field_name in TIME_FIELDS: editor = QDateTimeEdit(parent) editor.setDisplayFormat("yyyy-MM-dd hh:mm:ss") else: return QItemDelegate.createEditor(self, parent, option, index) self.connect(editor, SIGNAL("returnPressed()"), self.commitAndCloseEditor) return editor