levelmeter.h Example File
multimedia/spectrum/app/levelmeter.h
#ifndef LEVELMETER_H
#define LEVELMETER_H
#include <QTime>
#include <QWidget>
class LevelMeter : public QWidget
{
Q_OBJECT
public:
explicit LevelMeter(QWidget *parent = 0);
~LevelMeter();
void paintEvent(QPaintEvent *event) override;
public slots:
void reset();
void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
private slots:
void redrawTimerExpired();
private:
qreal m_rmsLevel;
qreal m_peakLevel;
qreal m_decayedPeakLevel;
QTime m_peakLevelChanged;
qreal m_peakDecayRate;
qreal m_peakHoldLevel;
QTime m_peakHoldLevelChanged;
QTimer *m_redrawTimer;
QColor m_rmsColor;
QColor m_peakColor;
};
#endif // LEVELMETER_H