qskinny/examples/iot-dashboard/CircularProgressBar.h

39 lines
790 B
C
Raw Normal View History

#ifndef CIRCULARPROGRESSBAR_H
#define CIRCULARPROGRESSBAR_H
#include <QGradient>
#include <QQuickPaintedItem>
class CircularProgressBar : public QQuickPaintedItem
{
2020-09-23 15:45:06 +00:00
public:
CircularProgressBar( const QGradient& gradient, int progress, QQuickItem* parent = nullptr );
2020-09-23 15:45:06 +00:00
virtual void paint( QPainter* painter ) override;
2020-09-23 15:45:06 +00:00
double width() const
{
return m_width;
}
2020-09-23 15:45:06 +00:00
void setWidth( double width )
{
m_width = width;
}
2020-09-23 15:45:06 +00:00
void setBackgroundColor( const QColor& color )
{
m_backgroundColor = color;
}
private:
QGradient m_gradient;
QColor m_backgroundColor;
double m_width = 20;
int m_progress;
};
#endif // CIRCULARPROGRESSBAR_H