{
painter->save();
painter
->setPen
(QPen(QBrush(Qt
::gray,Qt
::SolidPattern),
30,Qt::SolidLine,Qt::FlatCap,Qt::MiterJoin));
painter->drawEllipse(0, 0, 200, 200);
// draw your progress marker (the circle) over it
// rotate/translate painter so you don't have to do trigonometry
painter->translate(100,100); // move origin to middle
painter->rotate(...); // depending on your progress
painter->translate(0,80); // move origin into your ellipse
painter
->setPen
(QPen(QBrush(Qt
::green,Qt
::SolidPattern),
3,Qt::SolidLine,Qt::FlatCap,Qt::MiterJoin));
painter->drawEllipse(0, 0, 20,20);
painter->restore();
}
void ProgressWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
painter->save();
painter->setPen(QPen(QBrush(Qt::gray,Qt::SolidPattern),
30,Qt::SolidLine,Qt::FlatCap,Qt::MiterJoin));
painter->drawEllipse(0, 0, 200, 200);
// draw your progress marker (the circle) over it
// rotate/translate painter so you don't have to do trigonometry
painter->translate(100,100); // move origin to middle
painter->rotate(...); // depending on your progress
painter->translate(0,80); // move origin into your ellipse
painter->setPen(QPen(QBrush(Qt::green,Qt::SolidPattern),
3,Qt::SolidLine,Qt::FlatCap,Qt::MiterJoin));
painter->drawEllipse(0, 0, 20,20);
painter->restore();
}
To copy to clipboard, switch view to plain text mode
Bookmarks