Arc::Arc(QGraphicsItem *parent) : QGraphicsPolygonItem(parent){ setBrush(QBrush(Qt::white,Qt::SolidPattern)); setFillRule(Qt::WindingFill); PI = 3.141592; mBegAngle = 0.0f; mEndAngle = PI / 2; mRadOut = QPointF(100, 100); mCenter = QPointF(250, 250); QVector<QPolygonF> poly; poly.append(arcPoly); setupArc(10, poly);}void Arc::setupArc( int steps, QVector <QPolygonF> &poly ){ steps = qMax(steps, 1); qreal delta = (mEndAngle - mBegAngle) / steps; qreal angle = mBegAngle; qreal cos1 = cos(angle); qreal sin1 = sin(angle); for (int i = 0; i < steps; ++i) { angle += delta; qreal cos2 = cos(angle); qreal sin2 = sin(angle); poly.push_back(QPolygonF()); QPolygonF &dst = poly.back(); dst.push_back(QPointF(mRadOut.x() * cos1, mRadOut.y() * sin1)); dst.push_back(QPointF(mRadOut.x() * cos2, mRadOut.y() * sin2)); dst.push_back(QPointF(mRadIn.x() * cos2, mRadIn.y() * sin2)); dst.push_back(QPointF(mRadIn.x() * cos1, mRadIn.y() * sin1)); dst.translate(mCenter); cos1 = cos2; sin1 = sin2; setPolygon(dst); }}