Harmonize selectall behavior for delegated editors in the book list with other places these editors are used

By not having special selectAll behavior in the book list we can control
this system wide by changing the widget's initial selectall behavior
centrally.
This commit is contained in:
Kovid Goyal 2023-05-26 11:47:59 +05:30
parent c726b61dcc
commit b120cc9c03
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -318,7 +318,6 @@ class TextDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
editor.setText(get_val_for_textlike_columns(index)) editor.setText(get_val_for_textlike_columns(index))
editor.selectAll()
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
if isinstance(editor, EditWithComplete): if isinstance(editor, EditWithComplete):
@ -383,7 +382,6 @@ class CompleteDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
editor.setText(get_val_for_textlike_columns(index)) editor.setText(get_val_for_textlike_columns(index))
editor.selectAll()
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
if isinstance(editor, EditWithComplete): if isinstance(editor, EditWithComplete):
@ -493,12 +491,10 @@ class CcTextDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
text = index.data(Qt.ItemDataRole.DisplayRole) text = index.data(Qt.ItemDataRole.DisplayRole)
if text: if text:
editor.setText(text) editor.setText(text)
editor.selectAll()
return editor return editor
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
editor.setText(get_val_for_textlike_columns(index)) editor.setText(get_val_for_textlike_columns(index))
editor.selectAll()
def setModelData(self, editor, model, index): def setModelData(self, editor, model, index):
val = editor.text() or '' val = editor.text() or ''