[PyQt] QDateEdit is ignoring the sip API level 2

Phil Thompson phil at riverbankcomputing.com
Tue Jun 7 12:07:17 BST 2011


On Tue, 7 Jun 2011 11:46:08 +0100, Daniele Esposti <expo at expobrain.net>
wrote:
> Well, datetime package doesn't support operations with QDate
> instances, for example QDateEdit().date() + datetime.timedelta(days=1)
> raises a TypeError.

Just use...

QDateEdit().date().toPyDate() + datetime.timedelta()

> IMHO it's more clear to return a datetime instance instead a Qt one,
> like the QLineEdit.tex() method returns a unicode string instead of a
> QString if the sip API level for QString is set to 2. Again, IMHO.

I felt that QDate and QTime were too useful to remove.

Phil


More information about the PyQt mailing list