Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmediaplayer_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKMEDIAPLAYER_H
5#define QQUICKMEDIAPLAYER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QMediaPlayer>
19#include <QtQml/qqml.h>
20#include <qtmultimediaquickexports.h>
21#include <qurl.h>
22#include <private/qglobal_p.h>
23
25
26class Q_MULTIMEDIAQUICK_EXPORT QQuickMediaPlayer : public QMediaPlayer
27{
28 Q_OBJECT
29 Q_PROPERTY(QUrl source READ qmlSource WRITE qmlSetSource NOTIFY qmlSourceChanged FINAL)
30
31 Q_PROPERTY(bool autoPlay READ autoPlay WRITE setAutoPlay NOTIFY autoPlayChanged FINAL)
32
33 QML_NAMED_ELEMENT(MediaPlayer)
34
35public:
36 QQuickMediaPlayer(QObject *parent = nullptr);
37
38 void qmlSetSource(const QUrl &source);
39 QUrl qmlSource() const;
40
41 bool autoPlay() const;
42 void setAutoPlay(bool autoPlay);
43
44private:
45 void onMediaStatusChanged(QMediaPlayer::MediaStatus status);
46
47Q_SIGNALS:
48 void qmlSourceChanged(const QUrl &source);
49 void autoPlayChanged(bool autoPlay);
50
51private:
52 QUrl m_source;
53 bool m_autoPlay = false;
54 bool m_wasMediaLoaded = false;
55};
56
57QT_END_NAMESPACE
58
59#endif
Combined button and popup list for selecting options.