-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathqcrefresher.h
48 lines (34 loc) · 851 Bytes
/
qcrefresher.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef QCREFRESHER_H
#define QCREFRESHER_H
#include <QObject>
#include <QJSValue>
#include <QMap>
#include <QPointer>
#include <QTime>
class QCRefresher : public QObject
{
Q_OBJECT
Q_PROPERTY(int frameRate READ frameRate WRITE setFrameRate NOTIFY frameRateChanged)
public:
QCRefresher(QObject* parent = 0);
int frameRate() const;
void setFrameRate(int frameRate);
public slots:
void requestRefresh();
void markDirty(QObject* object);
signals:
void refresh();
void frameRateChanged();
protected:
void timerEvent(QTimerEvent *event);
private:
int m_frameRate;
int m_interval;
bool m_pending;
QTime timer;
// The elapsed time of last timer event
int lastElapsedTimerEvent;
QMap<QObject*,bool > dirtyObjects;
QList<QPointer<QObject> > list;
};
#endif // QCREFRESHER_H