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):
|
def show_initial_value(self, what):
|
||||||
what = unicode(what) if what else u''
|
what = unicode(what) if what else u''
|
||||||
le = self.lineEdit()
|
self.setText(what)
|
||||||
self.setEditText(what)
|
self.lineEdit().selectAll()
|
||||||
le.selectAll()
|
|
||||||
|
|
||||||
@dynamic_property
|
@dynamic_property
|
||||||
def all_items(self):
|
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))),
|
complete_items = sorted(list(m.db.all_custom(label=m.db.field_metadata.key_to_label(col))),
|
||||||
key=sort_key)
|
key=sort_key)
|
||||||
editor.update_items_cache(complete_items)
|
editor.update_items_cache(complete_items)
|
||||||
|
ct = index.data(Qt.DisplayRole).toString()
|
||||||
|
editor.show_initial_value(ct)
|
||||||
return editor
|
return editor
|
||||||
|
|
||||||
|
def setModelData(self, editor, model, index):
|
||||||
|
val = editor.text()
|
||||||
|
model.setData(index, QVariant(val), Qt.EditRole)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class CcNumberDelegate(QStyledItemDelegate): # {{{
|
class CcNumberDelegate(QStyledItemDelegate): # {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user