diff --git a/StatusBar.qml b/StatusBar.qml index bee8de1..2391be6 100644 --- a/StatusBar.qml +++ b/StatusBar.qml @@ -39,6 +39,13 @@ Pane { } } + Label { + Layout.fillWidth: true + Layout.fillHeight: true + + text: __controller.performance + ' FPS' + } + Button { Layout.fillHeight: true diff --git a/dmxcontroller.cpp b/dmxcontroller.cpp index f648b5f..41a53fb 100644 --- a/dmxcontroller.cpp +++ b/dmxcontroller.cpp @@ -149,6 +149,8 @@ void DmxController::sendDmxBuffer() if (m_lastInfo.msecsTo(now) >= 1000) { qInfo("%i per second", m_counter); + m_lastCounter = m_counter; + emit performanceChanged(m_counter); m_counter = 0; m_lastInfo = now; } diff --git a/dmxcontroller.h b/dmxcontroller.h index 69b93e3..3e9d84e 100644 --- a/dmxcontroller.h +++ b/dmxcontroller.h @@ -11,6 +11,7 @@ class DmxController : public QObject { Q_OBJECT + Q_PROPERTY(int performance READ performance NOTIFY performanceChanged) public: explicit DmxController(QObject *parent = nullptr); @@ -24,6 +25,11 @@ public: QReadWriteLock &projectLock() { return m_projectLock; } + int performance() const { return m_lastCounter; } + +signals: + void performanceChanged(int performance); + protected: friend class DmxControllerThread; @@ -41,4 +47,5 @@ private: QDateTime m_lastInfo; int m_counter; + std::atomic m_lastCounter; };