I want the user to be able to select Monday, Tuesday, Wednesday, Thursday or Friday (weekdays) in a QCalendarWidget. But not Saturday or Sunday. (weekend)
- Is this feature available for QCalendarWidget?
- If not, how do I disable a date on the calendar?
You can write a custom CalendarWidget and re-paint the cell as you want. As your request, you can check
date.dayOfWeek()
is 6 or 7.In this example, calendar widget can change color of selected date if the date is weekdays and no change if the date is weekends. But, the widget calendar still get event
clicked
. Hope this help.TestCalendar.h
TestCalendar.cpp
EDIT:
I add an image