I'm using PyQt 4.4.3.
I've got this code, which should clear all formats in the QCalendarWidget:
cal.setDateTextFormat(QDate(), QDateTextFormat())
According to the documentation this should work:
QCalendarWidget::setDateTextFormat(QDate &date, QTextCharFormat &format)
If date isnull
, all date formats are cleared.QDate::QDate()
Constructs a null date. Null dates are invalid.
I've tried narrowing down the problem like this:
>>> QDate().isNull() True >>> cal.dateTextFormat() {PyQt4.QtCore.QDate(-4713, 1, 1): PyQt4.QtGui.QTextCharFOrmat object}
Obviously, QDate()
is interpreted as being in the year -4713 instead of being null
.
Any idea what I need to change to make it work?
Edit: The problem is, that the calendar isn't reset using this method.