1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef FPSHELPER_H
5#define FPSHELPER_H
6
7#include <QQuickItem>
8#include <QElapsedTimer>
9
10class FpsHelper : public QQuickItem
11{
12 Q_OBJECT
13 Q_PROPERTY(float fps READ fps NOTIFY fpsChanged)
14
15public:
16 FpsHelper();
17
18 float fps() const;
19
20protected:
21 QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override;
22
23signals:
24 void fpsChanged();
25
26private:
27 float m_fps = 0.0f;
28 int m_frames = 0;
29 QElapsedTimer m_timer;
30};
31
32#endif // FPSHELPER_H
33

source code of qtquickeffectmaker/tools/qqem/fpshelper.h