Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to specify Holidays and Weekends in QCalendarWidget and change the Color.

How to specify Holidays and Weekends in QCalendarWidget and change the Color.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Hii...

    I am trying to create a calendar widget, in that the weekends are already shown in red color. Now i just want to specify some dates as Holidays and also i want to change the color of that specified dates (holidays) in Red color. How can i specify that these are the public holidays in a QCalendarWidget and to change its color.

    Thanks & Regards…

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Use "QCalendarWidget::setDateTextFormat":http://qt-project.org/doc/qt-5.0/qtwidgets/qcalendarwidget.html#setDateTextFormat to set the format of the specified date. Here is an example that applied the weekend format over a specified date:

      @
      QDate date(2013,2,28);
      QTextCharFormat format = myCalendarWidget->weekdayTextFormat(Qt::Saturday);

      myCalendarWidget->setDateTextFormat(date, format);
      @

      http://anavi.org/

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Macro
        wrote on last edited by
        #3

        Thanks leon.anavi for your suggestion... :) It Works... :)

        1 Reply Last reply
        0
        • L Offline
          L Offline
          leon.anavi
          wrote on last edited by
          #4

          [quote author="Rochi" date="1362061920"]Thanks leon.anavi for your suggestion... :) It Works... :)[/quote]

          Cool, you are welcome :)

          http://anavi.org/

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved