summaryrefslogtreecommitdiffstats
path: root/weather/loading.h
blob: 2735b28522833be4748cd7b8cd69dc44a99068e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef LOADING_H
#define LOADING_H

#include <QObject>
#include <QGraphicsItem>
#include <QBasicTimer>
#include <QPainter>

class Loading : public QObject, public QGraphicsItem
{
    Q_OBJECT
    Q_INTERFACES(QGraphicsItem)
public:
    Loading(QGraphicsItem *parent = 0);

    static void loadImages();

    QRectF boundingRect () const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

    void start() { m_ticker.start(50, this); }
    void stop() { m_ticker.stop(); }

protected:
    void timerEvent(QTimerEvent *event);

private:
    int m_image;
    const QRectF m_boundingRect;
    QBasicTimer m_ticker;
};

#endif // LOADING_H