2017-09-10 12:58:00 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QColor>
|
|
|
|
#include <QPaintEvent>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class LoadingIndicator : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2017-11-16 17:33:52 +03:00
|
|
|
Q_PROPERTY(QColor color READ color WRITE setColor)
|
2017-09-10 12:58:00 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
LoadingIndicator(QWidget *parent = 0);
|
|
|
|
virtual ~LoadingIndicator();
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
|
|
|
void start();
|
|
|
|
void stop();
|
|
|
|
|
2017-10-23 00:19:35 +03:00
|
|
|
QColor color() { return color_; }
|
|
|
|
void setColor(QColor color) { color_ = color; }
|
|
|
|
|
|
|
|
int interval() { return interval_; }
|
|
|
|
void setInterval(int interval) { interval_ = interval; }
|
2017-09-10 12:58:00 +03:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onTimeout();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int interval_;
|
|
|
|
int angle_;
|
|
|
|
|
|
|
|
QColor color_;
|
|
|
|
QTimer *timer_;
|
|
|
|
};
|