Book list: Press Shift+F2 to clear the contents of the current date like cell before editing it

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2015-10-15 13:14:01 +05:30
commit f8670c524c

View File

@ -223,7 +223,11 @@ class DateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
return DateTimeEdit(parent, self.format) return DateTimeEdit(parent, self.format)
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
QStyledItemDelegate.setEditorData(self, editor, index) if QApplication.keyboardModifiers() == Qt.ShiftModifier:
val = UNDEFINED_QDATETIME
else:
val = index.data(Qt.EditRole)
editor.setDateTime(val)
# }}} # }}}
@ -393,6 +397,9 @@ class CcDateDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
return DateTimeEdit(parent, self.format) return DateTimeEdit(parent, self.format)
def setEditorData(self, editor, index): def setEditorData(self, editor, index):
if QApplication.keyboardModifiers() == Qt.ShiftModifier:
val = UNDEFINED_QDATETIME
else:
m = index.model() m = index.model()
# db col is not named for the field, but for the table number. To get it, # db col is not named for the field, but for the table number. To get it,
# gui column -> column label -> table number -> db column # gui column -> column label -> table number -> db column