PDA

View Full Version : How to set Style sheet for QCalendarWidget?



nifei
6th February 2009, 09:19
Hi, all,
I have to customize the calendar's appearance via style sheet but no clue is given in the document. I know the qcalendarwidget includes a QCalendarView, a QCalendarModel and a QCalendarDelegate, while QAbstractItemView : : item {} does not work, as the QCalendarDelegate is subclass of QItemDelegate, other than QStyledItemDelegate.

Even I give up the style sheet, the calendar's QTextCharFormat cannot meet the requirements. QTextCharFormat could change the date's foreground color, background color and brush, but a solid rounded border is also needed! I don't know how to change it unless re-implement the QCalendarWidget : : paintCells(....).

Any Suggestion will be appreciated. Thanks in advance.

wysota
16th February 2009, 23:36
Reimplement QCalendarWidget::paintCell() and do what you want there.