nheko/src/ui/LoadingIndicator.h

38 lines
732 B
C
Raw Normal View History

2017-09-10 11:58:00 +02:00
#pragma once
#include <QColor>
#include <QWidget>
2020-01-31 06:12:02 +01:00
class QPainter;
class QTimer;
class QPaintEvent;
2017-09-10 11:58:00 +02:00
class LoadingIndicator : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
2017-09-10 11:58:00 +02:00
public:
2020-02-04 04:58:43 +01:00
LoadingIndicator(QWidget *parent = nullptr);
2017-09-10 11:58:00 +02:00
2020-02-04 15:18:26 +01:00
void paintEvent(QPaintEvent *e) override;
2017-09-10 11:58:00 +02:00
void start();
void stop();
2017-10-22 23:19:35 +02:00
QColor color() { return color_; }
void setColor(QColor color) { color_ = color; }
int interval() { return interval_; }
void setInterval(int interval) { interval_ = interval; }
2017-09-10 11:58:00 +02:00
private slots:
void onTimeout();
private:
int interval_;
int angle_;
QColor color_;
QTimer *timer_;
};