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. QDateEdit - Change the font color of the Date , if it is a Holiday?
Forum Updated to NodeBB v4.3 + New Features

QDateEdit - Change the font color of the Date , if it is a Holiday?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.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

    Hi...

    I have a QDateEdit. In that if the user enters a Date, which is of a holiday, then the color of the date should be changed to indicate that the mentioned date was a holiday... How can i specify the QDateEdit that these are the Holidays and only the color of these Dates should be changed.. Please post your suggestions....

    Example: If the user enters, (12-25-yyyy) then color of the Date should be changed to indicate the user that this date is invalid.
    and if he enters (02-27-2013) then it should display it as normal.

    Thanks & Regards...

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      For changing background or font format for a QDateEdit i use:
      @void QCalendarWidget::setDateTextFormat ( const QDate & date, const QTextCharFormat & format )@

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

        Thanks qxoz for your reply. Can u please suggest me how to specify the dates of holidays to a QDateEdit....

        Thanks & Regards...

        1 Reply Last reply
        0
        • U Offline
          U Offline
          utcenter
          wrote on last edited by
          #4

          Well, just create an arbitrary container, put all dates you want to be holidays in there, and check if a date is contained in the holidays container, if so, apply your custom font.

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

            Thanks utcenter for your suggestion...

            Another thing, I am trying to create a custom calendar widget, in that the weekends are already shown in red color. Now i just want to change the color of the public holidays in red color. How can i do that in a QCalendar Widget.

            Thanks & Regards...

            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