diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2017-09-14 09:56:30 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2017-09-28 14:00:26 +0000 |
commit | 62d72daf70fed1d7fa1c38bd52468b6536ec6cad (patch) | |
tree | 867428c277ac8cc0fcfa5c15003d6ad5b43f03cd /examples/multimediawidgets/player/histogramwidget.h | |
parent | 61b0771e832cad41c726995aafd7bea705909bdd (diff) |
Modernize the Player example
Fixed memory leak.
Renamed members, avoided passing args by copy.
Changed the style of member initialization.
Changed 0 to nullptr.
Changed to new signal/slot style if possible.
Removed Q_WS_SIMULATOR ifdef.
Changed signal/slot connection style.
Task-number: QTBUG-60627
Change-Id: I85bd6e56fe87f4e17f3c9964d6d1fdcb8202c519
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'examples/multimediawidgets/player/histogramwidget.h')
-rw-r--r-- | examples/multimediawidgets/player/histogramwidget.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/multimediawidgets/player/histogramwidget.h b/examples/multimediawidgets/player/histogramwidget.h index a85dd27e1..b55ab265f 100644 --- a/examples/multimediawidgets/player/histogramwidget.h +++ b/examples/multimediawidgets/player/histogramwidget.h @@ -56,7 +56,7 @@ public slots: void processFrame(QVideoFrame frame, int levels); signals: - void histogramReady(QVector<qreal> histogram); + void histogramReady(const QVector<qreal> &histogram); }; class HistogramWidget : public QWidget @@ -64,25 +64,25 @@ class HistogramWidget : public QWidget Q_OBJECT public: - explicit HistogramWidget(QWidget *parent = 0); + explicit HistogramWidget(QWidget *parent = nullptr); ~HistogramWidget(); void setLevels(int levels) { m_levels = levels; } public slots: - void processFrame(QVideoFrame frame); - void processBuffer(QAudioBuffer buffer); - void setHistogram(QVector<qreal> histogram); + void processFrame(const QVideoFrame &frame); + void processBuffer(const QAudioBuffer &buffer); + void setHistogram(const QVector<qreal> &histogram); protected: void paintEvent(QPaintEvent *event) override; private: QVector<qreal> m_histogram; - int m_levels; + int m_levels = 128; FrameProcessor m_processor; QThread m_processorThread; - bool m_isBusy; - QVector<QAudioLevel *> audioLevels; + bool m_isBusy = false; + QVector<QAudioLevel *> m_audioLevels; }; #endif // HISTOGRAMWIDGET_H |