Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to add text in QCalendarWidget ?



  • alt text


  • Qt Champions 2017

    Inherit from QCalendarWidget and reimplement paintCell function.
    void MyCalendar::paintCell(QPainter *painter, const QRect &rect, const QDate &date) const
    {
    qDebug() << Q_FUNC_INFO << endl;
    QCalendarWidget::paintCell(painter,rect,date);
    if(date==QDate::currentDate()){
    QFont font;
    font.setPixelSize(10);
    font.setBold(true);
    font.setItalic(true);
    painter->setFont(font);
    painter->drawText(rect.x()+10,rect.y()+33,"FIFA");
    }
    }


Log in to reply