mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix editing of text type custom columns in book list broken
This commit is contained in:
commit
5102a20efb
@ -357,9 +357,8 @@ class EditWithComplete(EnComboBox):
|
||||
|
||||
def show_initial_value(self, what):
|
||||
what = unicode(what) if what else u''
|
||||
le = self.lineEdit()
|
||||
self.setEditText(what)
|
||||
le.selectAll()
|
||||
self.setText(what)
|
||||
self.lineEdit().selectAll()
|
||||
|
||||
@dynamic_property
|
||||
def all_items(self):
|
||||
|
@ -249,8 +249,13 @@ class CcTextDelegate(QStyledItemDelegate): # {{{
|
||||
complete_items = sorted(list(m.db.all_custom(label=m.db.field_metadata.key_to_label(col))),
|
||||
key=sort_key)
|
||||
editor.update_items_cache(complete_items)
|
||||
ct = index.data(Qt.DisplayRole).toString()
|
||||
editor.show_initial_value(ct)
|
||||
return editor
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
val = editor.text()
|
||||
model.setData(index, QVariant(val), Qt.EditRole)
|
||||
# }}}
|
||||
|
||||
class CcNumberDelegate(QStyledItemDelegate): # {{{
|
||||
|
Loading…
x
Reference in New Issue
Block a user