Pressing the up arrow in an date edit with undefined value should jump to the current date rather than Feb 101

This commit is contained in:
Kovid Goyal 2016-11-22 20:59:21 +05:30
parent c3730a21a7
commit fcc685661d

View File

@ -57,6 +57,7 @@ def save_dialog(parent, title, msg, det_msg=''):
def clean_text(x):
return re.sub(r'\s', ' ', x.strip())
'''
The interface common to all widgets used to set basic metadata
class BasicMetadataWidget(object):
@ -1731,6 +1732,8 @@ class DateEdit(make_undoable(QDateTimeEdit), ToMetadataMixin):
elif ev.key() == Qt.Key_Equal:
ev.accept()
self.setDateTime(QDateTime.currentDateTime())
elif ev.key() == Qt.Key_Up and is_date_undefined(self.current_val):
self.setDateTime(QDateTime.currentDateTime())
else:
return super(DateEdit, self).keyPressEvent(ev)