mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #2021367 [Edit cell not longer select all content](https://bugs.launchpad.net/calibre/+bug/2021367)
This commit is contained in:
parent
340daa300c
commit
3f32a66c32
@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
from qt.core import (
|
||||
QLineEdit, QAbstractListModel, Qt, pyqtSignal, QObject, QKeySequence, QAbstractItemView,
|
||||
QApplication, QListView, QPoint, QModelIndex, QEvent,
|
||||
QApplication, QListView, QPoint, QModelIndex, QEvent, pyqtProperty,
|
||||
QStyleOptionComboBox, QStyle, QComboBox, QTimer, sip)
|
||||
|
||||
from calibre.constants import ismacos
|
||||
@ -515,6 +515,16 @@ class EditWithComplete(EnComboBox):
|
||||
def text(self):
|
||||
return self.lineEdit().text()
|
||||
|
||||
|
||||
@pyqtProperty(str)
|
||||
def currentText(self):
|
||||
return self.lineEdit().text()
|
||||
|
||||
@currentText.setter
|
||||
def currentText(self, text):
|
||||
self.setText(text)
|
||||
self.lineEdit().selectAll()
|
||||
|
||||
def selectAll(self):
|
||||
self.lineEdit().selectAll()
|
||||
|
||||
|
@ -30,8 +30,8 @@ class ItemDelegate(QStyledItemDelegate):
|
||||
|
||||
def setEditorData(self, editor, index):
|
||||
name = str(index.data(Qt.ItemDataRole.DisplayRole) or '')
|
||||
editor.setText(name)
|
||||
editor.lineEdit().selectAll()
|
||||
n = editor.metaObject().userProperty().name()
|
||||
editor.setProperty(n, name)
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
authors = string_to_authors(str(editor.text()))
|
||||
|
@ -381,7 +381,8 @@ class CompleteDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
|
||||
return editor
|
||||
|
||||
def setEditorData(self, editor, index):
|
||||
editor.setText(get_val_for_textlike_columns(index))
|
||||
n = editor.metaObject().userProperty().name()
|
||||
editor.setProperty(n, get_val_for_textlike_columns(index))
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
if isinstance(editor, EditWithComplete):
|
||||
@ -494,7 +495,8 @@ class CcTextDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
|
||||
return editor
|
||||
|
||||
def setEditorData(self, editor, index):
|
||||
editor.setText(get_val_for_textlike_columns(index))
|
||||
n = editor.metaObject().userProperty().name()
|
||||
editor.setProperty(n, get_val_for_textlike_columns(index))
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
val = editor.text() or ''
|
||||
|
Loading…
x
Reference in New Issue
Block a user