I need to create a custom calendar, where i need to change the look of each cell that contains a date. I tried this:
Qt Code:
  1. class CustomCalendarWidget : public QCalendarWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. CustomCalendarWidget( QWidget* parent = 0 ) : QCalendarWidget( parent ) {}
  6. ~CustomCalendarWidget() {}
  7.  
  8. protected:
  9. virtual void paintCell( QPainter* painter, const QRect& rect, const QDate& date ) const
  10. {
  11. painter->setPen( Qt::black );
  12. painter->drawText( rect, Qt::AlignCenter, tr("Qt by Nokia") ); //for example
  13. }
  14. };
To copy to clipboard, switch view to plain text mode 

But i get errors:
Qt Code:
  1. ..\Calendar_forum_v2\/customcalendarwidget.h: In member function 'virtual void CustomCalendarWidget::paintCell(QPainter*, const QRect&, const QDate&) const':
  2.  
  3. ..\Calendar_forum_v2\/customcalendarwidget.h:17: error: invalid use of incomplete type 'struct QPainter'
  4.  
  5. ..\..\..\NokiaQtSDK\Simulator\Qt\mingw\include/QtGui/qwindowdefs.h:68: error: forward declaration of 'struct QPainter'
  6.  
  7. ..\Calendar_forum_v2\/customcalendarwidget.h:18: error: invalid use of incomplete type 'struct QPainter'
  8.  
  9. ..\..\..\NokiaQtSDK\Simulator\Qt\mingw\include/QtGui/qwindowdefs.h:68: error: forward declaration of 'struct QPainter'
To copy to clipboard, switch view to plain text mode 

Could someone please explain to me - what am I doing wrong?