You will need to create your own subclass of QGraphicsView
and implement the drawForeground()
method. You can use this code as an example:
MyGraphicsView.h:
#ifndef MYGRAPHICSVIEW_H
#define MYGRAPHICSVIEW_H
#include <QGraphicsView>
class MyGraphicsView : public QGraphicsView
{
public:
MyGraphicsView(QWidget * parent = 0);
MyGraphicsView(QGraphicsScene * scene, QWidget * parent = 0);
virtual ~MyGraphicsView();
protected:
void drawForeground(QPainter * painter, const QRectF & rect);
};
#endif /* MYGRAPHICSVIEW_H */
MyGraphicsView.cpp:
#include "MyGraphicsView.h"
MyGraphicsView::MyGraphicsView(QWidget * parent) :
QGraphicsView(parent)
{
}
MyGraphicsView::MyGraphicsView(QGraphicsScene * scene, QWidget * parent) :
QGraphicsView(scene, parent)
{
}
MyGraphicsView::~MyGraphicsView()
{
}
void MyGraphicsView::drawForeground(QPainter * painter, const QRectF & rect)
{
int startAngle = 30 * 16;
int spanAngle = 120 * 16;
painter->drawArc(rect, startAngle, spanAngle);
}