libcuteradio
A Qt/C++ library and QML module to access the cuteRadio Data API.
 All Classes Functions Enumerations Properties Groups Pages
Public Slots | Signals | Public Member Functions | Properties | List of all members
CuteRadio::Model Class Reference

The base class for data models providing representations of cuteRadio Data API resources. More...

Inheritance diagram for CuteRadio::Model:
CuteRadio::ResourcesModel CuteRadio::CountriesModel CuteRadio::GenresModel CuteRadio::LanguagesModel CuteRadio::SearchesModel CuteRadio::StationsModel

Public Slots

void clear ()
 Removes all items.

Signals

void countChanged (int count)
 Emitted when items are added/removed.

Public Member Functions

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

int count
 The number of items in the model.

Detailed Description

The base class for data models providing representations of cuteRadio Data API resources.

Normally, you should not need to use this class.

Member Function Documentation

int CuteRadio::Model::find ( const QString &  property,
const QVariant &  value 
) const

Returns the row of the first item where its property matches value.

If no matching item exists, -1 is returned.

void CuteRadio::Model::insert ( const QModelIndex &  index,
const QMap< int, QVariant > &  roles 
)

Inserts an item before index using the data in roles.

The item is appended if index is invalid.

void CuteRadio::Model::insert ( int  row,
const QVariantMap &  properties 
)

Inserts an item before row to the model using properties.

If row is out of range, the item is appended.

bool CuteRadio::Model::remove ( const QModelIndex &  index)

Removes the item at index.

Returns true if succesful.

bool CuteRadio::Model::remove ( int  row)

Removes the item at row.

Returns true if successful.

bool CuteRadio::Model::set ( int  row,
const QVariantMap &  properties 
)

Sets the properties of the item at row to properties.

Returns true if successful.

bool CuteRadio::Model::setProperty ( int  row,
const QString &  property,
const QVariant &  value 
)

Sets the property of the item at row to value.

Returns true if successful.