tags:

views:

108

answers:

1

The standard behaviour is, that as soon as the day reaches 31 the step-up button stops working. I'd like it to reset to 1 and jump to the next month.

+2  A: 

I have not had the opportunity to test this, but I know that QDateEdit implements QAbstractSpinBox, so you should be able to call

myDateEdit.setWrapping(True)

which should accomplish what you want.

Doc Link

Update:

The term for this behaviour is apparently called "rollover" and here is one person's implementation, which (again, I haven't tested it) appears to be another potential solution:

Rollover QDateEdit

He makes the point that his implementation doesn't consider min or max dates though.

Chris Cameron
Works only partially. As soon as the day field reaches 32, it jumps back to 1. But it still doesn't increase the month count.
Georg
If that's the case, then you may have to re-implement stepBy/stepUp/stepDown in QDateTimeEdit, which if you've ever seen the source code for that is not very trivial. I'm working on this widget today coincidentally so I'll update if something comes to mind
Chris Cameron