How to Add Holidays to QCalendarWidget

From Qt Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The following source code marks the 3rd of March 2013 in a QCalendarWidget as a Holiday using the same style as weekends with QTextCharFormat.

QDate date(2013,3,3);
QTextCharFormat format = myCalendarWidget->weekdayTextFormat(Qt::Saturday);
myCalendarWidget->setDateTextFormat(date, format);