The QGalleryQueryModel class provides a model for the results of a gallery query. More...
#include <QGalleryQueryModel>
Inherits: QAbstractItemModel.
This class was introduced in Qt Mobility 1.1.
|
QGalleryQueryModel ( QObject * parent = 0 ) | |
QGalleryQueryModel ( QAbstractGallery * gallery, QObject * parent = 0 ) | |
~QGalleryQueryModel () | |
void | addColumn ( const QHash<int, QString> & properties ) |
void | addColumn ( const QString & property, int role = Qt::DisplayRole ) |
bool | autoUpdate () const |
void | cancel () |
void | clear () |
int | error () const |
QString | errorString () const |
void | execute () |
QGalleryFilter | filter () const |
QAbstractGallery * | gallery () const |
void | insertColumn ( int index, const QHash<int, QString> & properties ) |
void | insertColumn ( int index, const QString & property, int role = Qt::DisplayRole ) |
QVariant | itemId ( const QModelIndex & index ) const |
QString | itemType ( const QModelIndex & index ) const |
QUrl | itemUrl ( const QModelIndex & index ) const |
int | limit () const |
int | offset () const |
void | removeColumn ( int index ) |
QHash<int, QString> | roleProperties ( int column ) const |
QVariant | rootItem () const |
QString | rootType () const |
QGalleryQueryRequest::Scope | scope () const |
void | setAutoUpdate ( bool enabled ) |
void | setFilter ( const QGalleryFilter & filter ) |
void | setGallery ( QAbstractGallery * gallery ) |
void | setLimit ( int limit ) |
void | setOffset ( int offset ) |
void | setRoleProperties ( int column, const QHash<int, QString> & properties ) |
void | setRootItem ( const QVariant & itemId ) |
void | setRootType ( const QString & itemType ) |
void | setScope ( QGalleryQueryRequest::Scope scope ) |
void | setSortPropertyNames ( const QStringList & names ) |
QStringList | sortPropertyNames () const |
QGalleryAbstractRequest::State | state () const |
virtual int | columnCount ( const QModelIndex & parent = QModelIndex() ) const |
virtual QVariant | data ( const QModelIndex & index, int role = Qt::DisplayRole ) const |
virtual Qt::ItemFlags | flags ( const QModelIndex & index ) const |
virtual QVariant | headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const |
virtual QModelIndex | index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const |
virtual QModelIndex | parent ( const QModelIndex & index ) const |
virtual int | rowCount ( const QModelIndex & parent = QModelIndex() ) const |
virtual bool | setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ) |
virtual bool | setHeaderData ( int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole ) |
void | autoUpdateChanged () |
void | canceled () |
void | error ( int error, const QString & errorString ) |
void | errorChanged () |
void | filterChanged () |
void | finished () |
void | galleryChanged () |
void | limitChanged () |
void | offsetChanged () |
void | rootItemChanged () |
void | rootTypeChanged () |
void | scopeChanged () |
void | sortPropertyNamesChanged () |
void | stateChanged ( QGalleryAbstractRequest::State state ) |
The QGalleryQueryModel class provides a model for the results of a gallery query.
The meta-data that should be queried by a QGalleryQueryModel is specified by adding columns to the model, each column has a set of roleProperties() which map item data roles to gallery properties. After the model query has been executed the values of the properties requested for each column can be addressed using the roles they were mapped to.
The rootType property identifies the type of gallery item the request should return, if the root type has derivative types (i.e. an audio file is just a special case of a regular file) these will also be included in the result set.
The rootItem property takes the ID of an item the query should only return the children of. Depending on the scope of the query this may be {AllDescendents}{all descendents} or just the {DirectDescendents} {direct descendents} of the root item.
The results of a query can be further limited by setting a filter on the model. The model will evaluate the QGalleryFilter and only include items with meta-data matching the expression.
The order the results are returned in can be specified in the sortPropertyNames property which takes an ordered list of property names. By default properties are sorted in ascending order, but this can be specified explicitly be prefixing the property name with a '+' character for ascending order and a '-' character for descending order.
If the autoUpdate property is true when the query is executed it will enter an Idle state on finishing and will refresh the queried information if the items matching the query change. If the gallery can't provide updates it will instead go immediately to the Finished state. Automatic updates can be canceled by calling cancel() on a idle model.
See also QGalleryQueryRequest and QDocumentGallery.
This property holds whether a query should continue to update its result set after the initial query succeeded.
This property was introduced in Qt Mobility 1.1.
Access functions:
bool | autoUpdate () const |
void | setAutoUpdate ( bool enabled ) |
Notifier signal:
void | autoUpdateChanged () |
This property holds the error encountered by an unsuccessful query.
This property was introduced in Qt Mobility 1.1.
Access functions:
int | error () const |
void | error ( int error, const QString & errorString ) |
Notifier signal:
void | errorChanged () |
This property holds a string describing the cause of an error in more detail.
This may be an empty string if more information is not known.
This property was introduced in Qt Mobility 1.1.
Access functions:
QString | errorString () const |
Notifier signal:
void | errorChanged () |
This property holds a filter restricting the results of a query.
This property was introduced in Qt Mobility 1.1.
Access functions:
QGalleryFilter | filter () const |
void | setFilter ( const QGalleryFilter & filter ) |
Notifier signal:
void | filterChanged () |
This property holds the Gallery a model executes its queries against.
This property was introduced in Qt Mobility 1.1.
Access functions:
QAbstractGallery * | gallery () const |
void | setGallery ( QAbstractGallery * gallery ) |
Notifier signal:
void | galleryChanged () |
This property holds the maximum number of items a query should return.
This property was introduced in Qt Mobility 1.1.
Access functions:
int | limit () const |
void | setLimit ( int limit ) |
Notifier signal:
void | limitChanged () |
This property holds the offset of the first item a query should return.
This property was introduced in Qt Mobility 1.1.
Access functions:
int | offset () const |
void | setOffset ( int offset ) |
Notifier signal:
void | offsetChanged () |
This property holds the ID of the item a query should return the descendents of.
This property was introduced in Qt Mobility 1.1.
Access functions:
QVariant | rootItem () const |
void | setRootItem ( const QVariant & itemId ) |
Notifier signal:
void | rootItemChanged () |
See also scope().
This property holds the root item type the results of a query should be restricted to.
This property was introduced in Qt Mobility 1.1.
Access functions:
QString | rootType () const |
void | setRootType ( const QString & itemType ) |
Notifier signal:
void | rootTypeChanged () |
This property holds whether a query will return all descendents of its root item or just the direct decendents.
This property was introduced in Qt Mobility 1.1.
Access functions:
QGalleryQueryRequest::Scope | scope () const |
void | setScope ( QGalleryQueryRequest::Scope scope ) |
Notifier signal:
void | scopeChanged () |
See also rootItem().
This property holds a list of names of meta-data properties the results of a query should be sorted on.
Prefixing a property name with the '+' character indicates it should be sorted in ascending order, and a '-' character prefix indicates a descending order. If there is no prefix ascending order is assumed.
This property was introduced in Qt Mobility 1.1.
Access functions:
QStringList | sortPropertyNames () const |
void | setSortPropertyNames ( const QStringList & names ) |
Notifier signal:
void | sortPropertyNamesChanged () |
This property holds the state of a query.
This property was introduced in Qt Mobility 1.1.
Access functions:
QGalleryAbstractRequest::State | state () const |
Notifier signal:
void | stateChanged ( QGalleryAbstractRequest::State state ) |
Constructs a new query model.
The parent is passed to QAbstractItemModel.
Constructs a new model which queries items from a gallery.
The parent is passed to QAbstractItemModel.
This function was introduced in Qt Mobility 1.1.
Adds a column which maps the given properties to a query model.
The column will not be populated until the query is executed.
This function was introduced in Qt Mobility 1.1.
Adds a column which maps a meta-data property to role to a query model.
The column will not be populated until the query is executed.
This function was introduced in Qt Mobility 1.1.
Signals that the value of autoUpdate has changed.
This function was introduced in Qt Mobility 1.1.
Cancels a query.
This function was introduced in Qt Mobility 1.1.
Signals that the query was canceled.
This function was introduced in Qt Mobility 1.1.
Clears the results of a query.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::columnCount().
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::data().
This function was introduced in Qt Mobility 1.1.
See also setData().
Signals that the error and errorString properties have changed.
This function was introduced in Qt Mobility 1.1.
Executes a query.
This function was introduced in Qt Mobility 1.1.
Signals that the value of filter has changed.
This function was introduced in Qt Mobility 1.1.
Signals that the query has finished.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::flags().
This function was introduced in Qt Mobility 1.1.
Signals that the value of gallery has changed.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::headerData().
This function was introduced in Qt Mobility 1.1.
See also setHeaderData().
Reimplemented from QAbstractItemModel::index().
This function was introduced in Qt Mobility 1.1.
Inserts a column which maps the given properties into a query model at index.
The column will not be populated until the query is executed.
This function was introduced in Qt Mobility 1.1.
Inserts a column which maps a meta-data property to role into a query model at index.
The column will not be populated until the query is executed.
This function was introduced in Qt Mobility 1.1.
Returns the ID of the item at index.
This function was introduced in Qt Mobility 1.1.
Returns the type of the item at index.
This function was introduced in Qt Mobility 1.1.
Returns the URL of the item at index.
This function was introduced in Qt Mobility 1.1.
Signals that the value of limit has changed.
This function was introduced in Qt Mobility 1.1.
Signals that the value of offset has changed.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::parent().
This function was introduced in Qt Mobility 1.1.
Removes the column at index from a query model.
This function was introduced in Qt Mobility 1.1.
Returns the meta-data properties which a column maps to roles.
This function was introduced in Qt Mobility 1.1.
See also setRoleProperties().
Signals that the value of rootItem has changed.
This function was introduced in Qt Mobility 1.1.
Signals that the value of rootType has changed.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::rowCount().
This function was introduced in Qt Mobility 1.1.
Signals that the value of scope has changed.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QAbstractItemModel::setData().
This function was introduced in Qt Mobility 1.1.
See also data().
Reimplemented from QAbstractItemModel::setHeaderData().
This function was introduced in Qt Mobility 1.1.
See also headerData().
Sets the meta-data properties which a column maps to roles.
New properties will not be populated until the query is executed.
This function was introduced in Qt Mobility 1.1.
See also roleProperties().
Signals that the value of sortPropertyNames has changed.
This function was introduced in Qt Mobility 1.1.
Signals that the state of the query has changed.
This function was introduced in Qt Mobility 1.1.