summaryrefslogtreecommitdiffstats
path: root/examples/multimediawidgets/player/histogramwidget.h
diff options
context:
space:
mode:
authorSamuel Mira <samuel.mira@qt.io>2021-09-28 16:44:13 +0300
committerSamuel Mira <samuel.mira@qt.io>2021-10-13 09:07:18 +0300
commit9599406cdbf7eb6e84fb6b62704fe3d8a870441c (patch)
tree9cb62680a708e0db59df999faf3a7db6ac430370 /examples/multimediawidgets/player/histogramwidget.h
parent350c6b6f970de73d1e1fda91ec453f8c7255138f (diff)
Fix black rectangle on mediaplayer widget example
Multiple widgets are being created, but, in case of mobile ui, not all of them are added to layout. Those that are created with the player as the parent are added but not correctly positioned or used. Reordered calls to better understand what was being created and where. Prevented creation of widgets not being used on mobile. Fixes: QTBUG-96747 Pick-to: 6.2 Change-Id: I390ea534d7ea7f58b0fb30faac2bf5491d9723dd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'examples/multimediawidgets/player/histogramwidget.h')
-rw-r--r--examples/multimediawidgets/player/histogramwidget.h98
1 files changed, 0 insertions, 98 deletions
diff --git a/examples/multimediawidgets/player/histogramwidget.h b/examples/multimediawidgets/player/histogramwidget.h
deleted file mode 100644
index 08ba4f342..000000000
--- a/examples/multimediawidgets/player/histogramwidget.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef HISTOGRAMWIDGET_H
-#define HISTOGRAMWIDGET_H
-
-#include <QThread>
-#include <QVideoFrame>
-#include <QAudioBuffer>
-#include <QWidget>
-
-class QAudioLevel;
-
-class FrameProcessor: public QObject
-{
- Q_OBJECT
-
-public slots:
- void processFrame(QVideoFrame frame, int levels);
-
-signals:
- void histogramReady(const QList<qreal> &histogram);
-};
-
-class HistogramWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit HistogramWidget(QWidget *parent = nullptr);
- ~HistogramWidget();
- void setLevels(int levels) { m_levels = levels; }
-
-public slots:
- void processFrame(const QVideoFrame &frame);
- void processBuffer(const QAudioBuffer &buffer);
- void setHistogram(const QList<qreal> &histogram);
-
-protected:
- void paintEvent(QPaintEvent *event) override;
-
-private:
- QList<qreal> m_histogram;
- int m_levels = 128;
- FrameProcessor m_processor;
- QThread m_processorThread;
- bool m_isBusy = false;
- QList<QAudioLevel *> m_audioLevels;
-};
-
-#endif // HISTOGRAMWIDGET_H