mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Add example for dani
This commit is contained in:
parent
fe118766a3
commit
5e69677cf5
@ -7,6 +7,9 @@
|
||||
CPU::CPU(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
m_updateTimer.start(m_updateTimer);
|
||||
// signal obj, signal function pointer, slot obj, slot function pointer
|
||||
connect(&m_updateTimer,&QTimer::timeout,this,&CPU::update);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
@ -15,6 +16,7 @@ class CPU : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(float usage READ usage NOTIFY usageChanged)
|
||||
Q_PROPERTY(int tickRate READ tickRate WRITE setTickRate NOTIFY tickRateChanged)
|
||||
|
||||
public:
|
||||
explicit CPU(QObject* parent = nullptr);
|
||||
@ -25,10 +27,17 @@ public:
|
||||
return m_usage;
|
||||
}
|
||||
|
||||
int tickRate() const
|
||||
{
|
||||
return m_tickRate;
|
||||
}
|
||||
|
||||
signals:
|
||||
|
||||
void usageChanged(float usage);
|
||||
|
||||
void tickRateChanged(int tickRate);
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
|
||||
@ -42,6 +51,17 @@ public slots:
|
||||
emit usageChanged(m_usage);
|
||||
}
|
||||
|
||||
void setTickRate(int tickRate)
|
||||
{
|
||||
if (m_tickRate == tickRate)
|
||||
return;
|
||||
|
||||
qDebug() << "hat sich was geändert";
|
||||
|
||||
m_tickRate = tickRate;
|
||||
emit tickRateChanged(m_tickRate);
|
||||
}
|
||||
|
||||
private:
|
||||
float m_usage = 42.0f;
|
||||
|
||||
@ -53,4 +73,5 @@ private:
|
||||
|
||||
static int c_NumOfProcessors;
|
||||
static ULONG c_BufferSize;
|
||||
int m_tickRate;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user