QMediaContent Class

The QMediaContent class provides access to the resource relating to a media content. More...

Header: #include <QMediaContent>
qmake: QT += multimedia

Public Functions

QMediaContent(QMediaPlaylist *playlist, const QUrl &contentUrl = QUrl(), bool takeOwnership = false)
QMediaContent(const QMediaContent &other)
QMediaContent(const QNetworkRequest &request)
QMediaContent(const QUrl &url)
QMediaContent &operator=(const QMediaContent &other)
bool isNull() const
QMediaPlaylist *playlist() const
bool operator!=(const QMediaContent &other) const
bool operator==(const QMediaContent &other) const

Detailed Description

QMediaContent is used within the multimedia framework as the logical handle to media content. A QMediaContent object contains a QNetworkRequest which provides the URL of the content.

A non-null QMediaContent will always have a reference to the content available through the request() method.

Alternatively QMediaContent can represent a playlist and contain a pointer to a valid QMediaPlaylist object. In this case URL is optional and can either be empty or point to the playlist URL.

Member Function Documentation

QMediaContent::QMediaContent(QMediaPlaylist *playlist, const QUrl &contentUrl = QUrl(), bool takeOwnership = false)

Constructs a media content with playlist.

contentUrl of a playlist is an optional parameter and can be empty.

Set takeOwnership to true if you want QMediaContent to take ownership of the playlist. takeOwnership is set to false by default.

QMediaContent::QMediaContent(const QMediaContent &other)

Constructs a copy of the media content other.

QMediaContent::QMediaContent(const QNetworkRequest &request)

Constructs a media content with request providing a reference to the content.

This constructor can be used to reference media content via network protocols such as HTTP. This may include additional information required to obtain the resource, such as Cookies or HTTP headers.

QMediaContent::QMediaContent(const QUrl &url)

Constructs a media content with url providing a reference to the content.


Constructs a null QMediaContent.

QMediaContent &QMediaContent::operator=(const QMediaContent &other)

Assigns the value of other to this media content.


Destroys the media content object.

bool QMediaContent::isNull() const

Returns true if this media content is null (uninitialized); false otherwise.

QMediaPlaylist *QMediaContent::playlist() const

Returns a playlist for this media content or 0 if this QMediaContent is not a playlist.

bool QMediaContent::operator!=(const QMediaContent &other) const

Returns true if other is not equivalent to this media content; false otherwise.

bool QMediaContent::operator==(const QMediaContent &other) const

Returns true if other is equivalent to this media content; false otherwise.

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.