-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfrequencymonitor.h
42 lines (32 loc) · 919 Bytes
/
frequencymonitor.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
#ifndef FREQUENCYMONITOR_H
#define FREQUENCYMONITOR_H
#include <QQuickItem>
#include <QTime>
#include <QMetaObject>
class QQuickWindow;
class FrequencyMonitor : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(int fps READ fps NOTIFY fpsChanged)
Q_PROPERTY(int refreshPeriod READ refreshPeriod WRITE setRefreshPeriod NOTIFY refreshPeriodChanged)
public:
explicit FrequencyMonitor(QQuickItem *parent = 0);
int fps() const;
void setFps(int fps);
// by default refresh one time per 1000 msec
int refreshPeriod() const;
void setRefreshPeriod(int msec);
signals:
void fpsChanged();
void refreshPeriodChanged();
public slots:
void handleAfterRendering();
void handleWindowChanged(QQuickWindow * window);
protected:
QMetaObject::Connection m_windowConnection;
QTime m_time;
int m_fps;
int m_counter;
int m_refreshPeriod;
};
#endif // FREQUENCYMONITOR_H