Make analyzers use QBasicTimer instead of QTimer
This commit is contained in:
parent
f1ff15d2f7
commit
d5a3c74043
|
@ -49,7 +49,6 @@ Analyzer::Base::Base( QWidget *parent, uint scopeSize )
|
||||||
, m_engine(NULL)
|
, m_engine(NULL)
|
||||||
, m_lastScope(512)
|
, m_lastScope(512)
|
||||||
{
|
{
|
||||||
connect( &m_timer, SIGNAL( timeout() ), SLOT( update() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::Base::hideEvent(QHideEvent *) {
|
void Analyzer::Base::hideEvent(QHideEvent *) {
|
||||||
|
@ -57,7 +56,7 @@ void Analyzer::Base::hideEvent(QHideEvent *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::Base::showEvent(QShowEvent *) {
|
void Analyzer::Base::showEvent(QShowEvent *) {
|
||||||
m_timer.start(timeout());
|
m_timer.start(timeout(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::Base::transform( Scope &scope ) //virtual
|
void Analyzer::Base::transform( Scope &scope ) //virtual
|
||||||
|
@ -217,3 +216,10 @@ Analyzer::initSin( Scope &v, const uint size ) //static
|
||||||
radian += step;
|
radian += step;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Analyzer::Base::timerEvent(QTimerEvent* e) {
|
||||||
|
if (e->timerId() != m_timer.timerId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "engines/engine_fwd.h"
|
#include "engines/engine_fwd.h"
|
||||||
#include "fht.h" //stack allocated and convenience
|
#include "fht.h" //stack allocated and convenience
|
||||||
#include <QPixmap> //stack allocated and convenience
|
#include <QPixmap> //stack allocated and convenience
|
||||||
#include <QTimer> //stack allocated
|
#include <QBasicTimer> //stack allocated
|
||||||
#include <QWidget> //baseclass
|
#include <QWidget> //baseclass
|
||||||
#include <vector> //included for convenience
|
#include <vector> //included for convenience
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ protected:
|
||||||
void hideEvent(QHideEvent *);
|
void hideEvent(QHideEvent *);
|
||||||
void showEvent(QShowEvent *);
|
void showEvent(QShowEvent *);
|
||||||
void paintEvent( QPaintEvent* );
|
void paintEvent( QPaintEvent* );
|
||||||
|
void timerEvent(QTimerEvent *);
|
||||||
|
|
||||||
void polishEvent();
|
void polishEvent();
|
||||||
|
|
||||||
|
@ -62,14 +63,16 @@ protected:
|
||||||
virtual void paused(QPainter& p);
|
virtual void paused(QPainter& p);
|
||||||
virtual void demo(QPainter& p);
|
virtual void demo(QPainter& p);
|
||||||
|
|
||||||
void changeTimeout( uint newTimeout )
|
void changeTimeout( uint newTimeout ) {
|
||||||
{
|
m_timeout = newTimeout;
|
||||||
m_timer.setInterval( newTimeout );
|
if (m_timer.isActive()) {
|
||||||
m_timeout = newTimeout;
|
m_timer.stop();
|
||||||
|
m_timer.start(m_timeout, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QTimer m_timer;
|
QBasicTimer m_timer;
|
||||||
uint m_timeout;
|
uint m_timeout;
|
||||||
FHT *m_fht;
|
FHT *m_fht;
|
||||||
EngineBase* m_engine;
|
EngineBase* m_engine;
|
||||||
|
|
Loading…
Reference in New Issue