Fix #2074147 [[Enhancement Request] Date change form 'undefined' with mouse wheel error](https://bugs.launchpad.net/calibre/+bug/2074147)

This commit is contained in:
Kovid Goyal 2024-07-26 12:32:27 +05:30
parent d5c2fa29ec
commit e5ef3b8b88
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2004,6 +2004,13 @@ class DateEdit(make_undoable(DateTimeEdit), ToMetadataMixin):
else:
return super().keyPressEvent(ev)
def wheelEvent(self, ev):
if is_date_undefined(self.current_val):
self.setDateTime(QDateTime.currentDateTime())
ev.accept()
else:
return super().wheelEvent(ev)
class PubdateEdit(DateEdit):
LABEL = _('P&ublished:')