void Calendar::paintCell( QPainter * painter, const QRect & rect, const QDate & date ) const{ painter->setBackground(QBrush(Qt::red)); QCalendarWidget::paintCell(painter,rect,date);}
C++ (Qt)if(date.dayOfWeek()==Qt::Sunday){ painter->fillRect(rect, Qt::white); painter->save(); painter->setPen(Qt::green); painter->drawText(rect, Qt::AlignCenter, QString::number(date.day())); painter->restore();} else QCalendarWidget::paintCell(painter, rect, date);
C++ (Qt) QTextCharFormat charformat;charformat.setBackground(QBrush(Qt::red));ui->calendarWidget->setWeekdayTextFormat(Qt::Sunday,charformat);
C++ (Qt) ui->calendarWidget->setStyleSheet("QAbstractItemView {background-color: rgb(255, 0, 0)}");
QTextCharFormat format; QBrush brush; QColor color; int r=200,g=145,b=234,a=120; color.setRgb(r,g,b,a);; brush.setColor(color); format.setBackground(brush); QDate date(2010,8,10); ui->calendarWidget->setDateTextFormat(date,format);