ProgressWidget::ProgressWidget()
{
r1.setRect(85,-13.5,30,30);
path.addEllipse(r1);
}
{
painter->save();
painter
->setPen
(QPen(QBrush(Qt
::gray,Qt
::SolidPattern),
30,Qt
::SolidLine,Qt
::FlatCap,Qt
::MiterJoin));
painter->drawEllipse(0, 0, 200, 200);
painter->restore();
painter
->fillPath
( path,
QBrush( Qt
::green, Qt
::SolidPattern ) );
}
QRectF ProgressWidget
::boundingRect() const {
qreal penWidth = 150;
return QRectF(-10 - penWidth
/ 2,
-10 - penWidth
/ 2,
20 + penWidth
/ 2,
20 + penWidth
/ 2);
}
ProgressWidget::ProgressWidget()
{
r1.setRect(85,-13.5,30,30);
path.addEllipse(r1);
}
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);
painter->restore();
painter->fillPath( path, QBrush( Qt::green, Qt::SolidPattern ) );
}
QRectF ProgressWidget::boundingRect() const
{
qreal penWidth = 150;
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,20 + penWidth / 2, 20 + penWidth / 2);
}
To copy to clipboard, switch view to plain text mode
{
public:
ProgressWidget();
~ProgressWidget();
};
class ProgressWidget:public QGraphicsItem
{
public:
QRectF r1;
QPainterPath path;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
QRectF boundingRect() const;
ProgressWidget();
~ProgressWidget();
};
To copy to clipboard, switch view to plain text mode
Bookmarks