Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMediaList Class Reference
[QtMediaModule]

The QMediaList class provides a filtered list of media content. More...

    #include <QMediaList>

Inherits QAbstractListModel.

Public Types

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QMediaList class provides a filtered list of media content.

The QMediaList class is useful for displaying media content filtered by Artist, Album, Genre etc. For example to display a list of music by artist name containing "Billy".

    mediaPlaylist = QMediaList();
    itemview->setModel( mediaPlaylist );
    mediaPlaylist.clearFilter();
    mediaPlaylist.setDisplayRole(QMediaList::Title);
    mediaPlaylist.beginFilter();
    mediaList.setFilter(QMediaList::MimeType,"audio");
    mediaList.addFilter(QMediaList::Artist, "Billy");
    mediaList.randomize();
    mediaList.endFilter();

Member Type Documentation

enum QMediaList::Grouping

ConstantValueDescription
QMediaList::ShowAll0Display All entries.
QMediaList::ShowGrouped1Display a unique list.

enum QMediaList::Properties

ConstantValueDescription
QMediaList::ShowEmpty0Display empty field when no data is available.
QMediaList::ShowEmptyAsUnknown1Display Unknown when empty field.
QMediaList::HideEmpty2Do not display if field has no data.

enum QMediaList::Roles

ConstantValueDescription
QMediaList::Title0x01Title of media
QMediaList::Url0x02Filename, http address
QMediaList::Artist0x04Artist of media
QMediaList::Album0x08Album of media
QMediaList::Genre0x10Genre of media
QMediaList::MimeType0x40MimeType of media

enum QMediaList::SortDirection

ConstantValueDescription
QMediaList::Ascending0Ascending order sorting.
QMediaList::Descending1Descending order sorting.
QMediaList::Unsorted2No sorting.


Member Function Documentation

QMediaList::QMediaList ()

Constructs a list from the Document System.

QMediaList::QMediaList ( const QMediaPlaylist & playlist )

Constructs a QMediaList from a QMediaPlaylist playlist.

QMediaList::QMediaList ( const QMediaList & other )

Constructs a copy of the other QMediaList.

bool QMediaList::addFilter ( Roles filterType, const QString & text )

Appends new filter on Category filterType containing string text

eg. addFilter(QMediaList::Title,"Billy");

Returns false on error.

void QMediaList::beginFilter ()

Set filter mode to create, filter will not be applied until endFilter() is called.

void QMediaList::clearFilter ()

Resets current filter.

Grouping QMediaList::displayGrouping () const

Returns whether to display all, or to aggregate the data type set by setDisplayRole()

int QMediaList::displayRole () const

Returns the media lists default display role

See also setDisplayRole() and Qt::DisplayRole.

void QMediaList::endFilter ()

Applies current filter to data.

bool QMediaList::isFiltered () const

Returns true if filters are in effect on the model.

QMediaPlaylist QMediaList::playlist ( const QModelIndex & index = QModelIndex() ) const

Constructs a QMediaPlaylist from the selected index, or if index is empty, then from the whole QMediaList.

void QMediaList::randomize ()

Randomizes the filtered list.

void QMediaList::refreshData ()   [protected]

Applies current filters to data and refresh content of list.

bool QMediaList::removeFilter ( Roles filterType )

Removes filter on Category filterType

eg. removeFilter(QMediaList::Album);

Returns false on error.

void QMediaList::setDisplayRole ( int role, Grouping grouping = ShowGrouped )

Set what role is currently begin displayed. Setting the grouping changes the display from unique to all.

Options for role are: QMediaPlaylist::DataRole

eg. setDisplayRole(QMediaPlaylist::Title, QMediaList::ShowAll);

See also displayRole().

bool QMediaList::setFilter ( Roles filterType, const QString & text )

Resets current filter, applying new filter on Category filterType containing string text

eg. setFilter(QMediaList::MimeType,"audio");

Returns false on error.

void QMediaList::setModel ( const QMediaPlaylist & playlist )

Sets the given model to be used as the data provider for the list to playlist

void QMediaList::setSorting ( SortDirection sortType )

Sorts the list by sortType

void QMediaList::setSorting ( QList<int> roles, SortDirection sortType )

This is an overloaded member function, provided for convenience.

Sorts the list by sortType, using sort order roles

void QMediaList::showEmpty ( Properties role )

Set role to handle empty data field.

Options for role are: QMediaList::Properties

eg. showEmpty(QMediaList::HideEmpty);

QMediaList & QMediaList::operator= ( const QMediaList & medialist )

Assigns the specified medialist to this object.

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

Returns true if this QMediaList and the other are equal; otherwise returns false.


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3