def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] key = m.db.field_metadata.key_to_label(col) if m.db.field_metadata[col]['datatype'] != 'comments': editor = EditWithComplete(parent) editor.set_separator(None) complete_items = sorted(list(m.db.all_custom(label=key)), key=sort_key) editor.update_items_cache(complete_items) else: editor = QLineEdit(parent) text = index.data(Qt.ItemDataRole.DisplayRole) if text: editor.setText(text) editor.selectAll() return editor
def createEditor(self, parent, option, index): m = index.model() col = m.column_map[index.column()] key = m.db.field_metadata.key_to_label(col) if m.db.field_metadata[col]['datatype'] != 'comments': editor = EditWithComplete(parent) editor.set_separator(None) complete_items = sorted(list(m.db.all_custom(label=key)), key=sort_key) editor.update_items_cache(complete_items) else: editor = QLineEdit(parent) text = index.data(Qt.DisplayRole) if text: editor.setText(text) editor.selectAll() return editor