qskinny/examples/iot-dashboard/CircularProgressBar.h

53 lines
1.1 KiB
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-30 15:38:51 +00:00
QColor backgroundColor() const
{
return m_backgroundColor;
}
2020-09-23 15:45:06 +00:00
void setBackgroundColor( const QColor& color )
{
m_backgroundColor = color;
}
2020-09-30 14:25:42 +00:00
QRadialGradient ringGradient() const
{
return m_ringGradient;
}
2020-09-23 15:45:06 +00:00
2020-09-30 14:25:42 +00:00
void setRingGradient( const QRadialGradient& gradient )
{
m_ringGradient = gradient;
}
2020-09-23 15:45:06 +00:00
private:
QGradient m_gradient;
QColor m_backgroundColor;
2020-09-30 14:25:42 +00:00
QRadialGradient m_ringGradient;
2020-09-23 15:45:06 +00:00
double m_width = 20;
int m_progress;
};
#endif // CIRCULARPROGRESSBAR_H