|
libcuteradio
A Qt/C++ library and QML module to access the cuteRadio Data API.
|
A list model for retrieving cuteRadio resources. More...
Public Slots | |
| void | cancel () |
| Cancels the current request. | |
| void | reload () |
| Clears any existing data and retreives a new list of cuteRadio resources using the existing properties. | |
Public Slots inherited from CuteRadio::Model | |
| void | clear () |
| Removes all items. | |
Signals | |
| void | accessTokenChanged () |
| Emitted when the accessToken changes. | |
| void | statusChanged (CuteRadio::ResourcesRequest::Status s) |
| Emitted when the status changes. | |
Signals inherited from CuteRadio::Model | |
| void | countChanged (int count) |
| Emitted when items are added/removed. | |
Public Member Functions | |
| void | setNetworkAccessManager (QNetworkAccessManager *manager) |
| Sets the QNetworkAccessManager instance to be used when making requests to the cuteRadio Data API. | |
Public Member Functions inherited from CuteRadio::Model | |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| Returns the number of items in the model. | |
| QVariant | data (const QModelIndex &index, int role) const |
| Re-implemented from QAbstractListModel::data() | |
| QMap< int, QVariant > | itemData (const QModelIndex &index) const |
| Re-implemented from QAbstractListModel::itemData() | |
| bool | setData (const QModelIndex &index, const QVariant &value, int role) |
| Re-implemented from QAbstractListModel::setData() | |
| bool | setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles) |
| Re-implemented from QAbstractListModel::setItemData() | |
| void | append (const QMap< int, QVariant > &roles) |
| Appends an item using the data in roles. | |
| void | insert (const QModelIndex &index, const QMap< int, QVariant > &roles) |
| Inserts an item before index using the data in roles. | |
| bool | remove (const QModelIndex &index) |
| Removes the item at index. | |
| Q_INVOKABLE int | find (const QString &property, const QVariant &value) const |
| Returns the row of the first item where its property matches value. | |
| Q_INVOKABLE QVariantMap | get (int row) const |
| Returns the item at row. | |
| Q_INVOKABLE bool | setProperty (int row, const QString &property, const QVariant &value) |
| Sets the property of the item at row to value. | |
| Q_INVOKABLE bool | set (int row, const QVariantMap &properties) |
| Sets the properties of the item at row to properties. | |
| Q_INVOKABLE void | append (const QVariantMap &properties) |
| Appends an item to the model using properties. | |
| Q_INVOKABLE void | insert (int row, const QVariantMap &properties) |
| Inserts an item before row to the model using properties. | |
| Q_INVOKABLE bool | remove (int row) |
| Removes the item at row. | |
Properties | |
| QString | accessToken |
| The access token to be used when making requests to the cuteRadio Data API. | |
| QString | resource |
| The resource type to be retrieved by the model. | |
| QVariantMap | filters |
| A map of key/value pairs used to filter requests. | |
| CuteRadio::ResourcesRequest::Status | status |
| The current status of the model. | |
| QVariant | result |
| The current result of the model. | |
| CuteRadio::ResourcesRequest::Error | error |
| The error type of the model. | |
| QString | errorString |
| A description of the error of the model. | |
Properties inherited from CuteRadio::Model | |
| int | count |
| The number of items in the model. | |
A list model for retrieving cuteRadio resources.
The ResourcesModel is a list model used for retrieving and displaying cuteRadio resources in a list view. ResourcesModel provides the same methods that are available in ResourcesRequest, so it is better to simply use that class if you do not need the additional features provided by a data model.
Roles
The roles and role names of ResourcesModel are created dynamically when the model is populated with data. The roles are created by iterating through the keys of the first item in alphabetical order, starting at Qt::UserRole + 1. The role names are the keys themselves.
Example usage:
C++
QML
|
slot |
Cancels the current request.
| void CuteRadio::ResourcesModel::setNetworkAccessManager | ( | QNetworkAccessManager * | manager | ) |
Sets the QNetworkAccessManager instance to be used when making requests to the cuteRadio Data API.
ResourcesModel does not take ownership of manager.
If no QNetworkAccessManager is set, one will be created when required.
|
readwrite |
The access token to be used when making requests to the cuteRadio Data API.
The access token is required when accessing protected resources.
|
read |
The error type of the model.
|
read |
A description of the error of the model.
|
readwrite |
The resource type to be retrieved by the model.
Possible values are:
| Resource |
|---|
| countries |
| favourites |
| genres |
| languages |
| playedstations |
| searches |
| stations |
|
read |
The current result of the model.
|
read |
The current status of the model.
1.8.1.2