I've created a calendar widget with its styleSheet, current date text format and set up date selection via .clicked function.
#setting up calendar
self.dateWidget = QCalendarWidget()
#setting up current date font format (on the app start)
self.painter = QTextCharFormat()
self.painter.setFont(QFont("Times", 20, 200))
self.dateWidget.setDateTextFormat(self.dateWidget.selectedDate(), self.painter)
#selecting current date on the app start, then connecting event for changing the date on click.
self.date = self.dateWidget.selectedDate()
self.dateWidget.clicked[QDate].connect(self.ChooseDate)
def ChooseDate(self, clicked=""):
self.dateWidget.setDateTextFormat(clicked, self.painter)
self.date = arrow.get(clicked.year(), clicked.month(), clicked.day())
print(f'{self.date}: {self.time}')
When some date is clicked, its font gets modified.
But when another date is clicked, the previous date's font stays modified. How do I reset the font of a de-selected (previous) date back to default - at the same time leaving the font of the TODAY date (which style is applied on app start) the same (increased)?
Pic.1 - Current date, selected on app start.
Pic.2 - Some date clicked. TODAY date (22nd) must stay as it is.
Pic.3 - Another date clicked. TODAY date (22nd) must stay as it is, but 24th must be reset to default.