I have following class declaration:
Qt Code:
  1. class GraphicsArc : public GraphicsComponent
  2. {
  3. public:
  4. enum { Type = Arc };
  5.  
  6. explicit GraphicsArc();
  7. explicit GraphicsArc(const ArcF &arc);
  8. explicit GraphicsArc(qreal cx, qreal cy, qreal radius, qreal startAngle, qreal spanAngle);
  9. ~GraphicsArc();
  10.  
  11. QRectF boundingRect() const;
  12. QPainterPath shape() const;
  13. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
  14.  
  15. ArcF arc() const;
  16. void setArc(const ArcF &arc);
  17.  
  18. int type() const { return Type; }
  19.  
  20. private:
  21. void updateBoundingRect();
  22. QPointF endPoint(const QPointF &center, qreal radius, qreal angle);
  23.  
  24. ArcF m_arc;
  25. QRectF bounding_rect;
  26. };
To copy to clipboard, switch view to plain text mode 

and problem is here:

Qt Code:
  1. ...
  2. QPainterPath GraphicsArc::shape() const
  3. {
  4.  
  5. QPointF sp1 (endPoint(m_arc.center(), m_arc.radius() - 5, -m_arc.startAngle()));
  6. QPointF sp2 (endPoint(m_arc.center(), m_arc.radius() + 5, -m_arc.startAngle()));
  7. ...
To copy to clipboard, switch view to plain text mode 

Compiler says:
..\TestGraphicView\graphicsarc.cpp: In member function 'virtual QPainterPath GraphicsArc::shape() const':
..\TestGraphicView\graphicsarc.cpp:42: error: passing 'const GraphicsArc' as 'this' argument of 'QPointF GraphicsArc::endPoint(const QPointF&, qreal, qreal)' discards qualifiers
..\TestGraphicView\graphicsarc.cpp:43: error: passing 'const GraphicsArc' as 'this' argument of 'QPointF GraphicsArc::endPoint(const QPointF&, qreal, qreal)' discards qualifiers
I do not understand that, because there also a function updateBoundingRect, which also use endPoint(), and does not have same problem. I think it has something to do with virtual function, but I am not sure what.