It is possible override the default behaviour by reimplementing stepBy
:
class DateEdit(QtGui.QDateEdit):
def stepBy(self, steps):
self.setDateTime(self.dateTime().addDays(steps))
However, this doesn't quite work perfectly, because the cursor must be in the year section to get continuous increments. If it's in the month section, it will only increment through all months/days in the year; and if it's in the day section, it will only increment through all days in the month. Personally, I think I would treat this as a "feature", and leave it at that (since the implementaion is so simple).
You could try to force the cursor to stay in the year section, but that would prevent manual editing, which significantly reduces usability. However, I suppose you could use the calendar-popup to provide manual editing, and then make the line-edit read-only:
class DateEdit(QtGui.QDateEdit):
def __init__(self, *args, **kwargs):
super(DateEdit, self).__init__(*args, **kwargs)
self.setCalendarPopup(True)
edit = self.lineEdit()
edit.setReadOnly(True)
edit.selectionChanged.connect(lambda edit=edit: edit.end(False))
def stepBy(self, steps):
self.setDateTime(self.dateTime().addDays(steps))