The QGalleryQueryRequest class provides a request for a set of items from a gallery. More...
#include <QGalleryQueryRequest>
Inherits: QGalleryAbstractRequest.
This class was introduced in Qt Mobility 1.1.
enum | Scope { AllDescendants, DirectDescendants } |
|
|
QGalleryQueryRequest ( QObject * parent = 0 ) | |
QGalleryQueryRequest ( QAbstractGallery * gallery, QObject * parent = 0 ) | |
~QGalleryQueryRequest () | |
bool | autoUpdate () const |
int | currentIndex () const |
QGalleryFilter | filter () const |
bool | first () |
bool | isValid () const |
int | itemCount () const |
QVariant | itemId () const |
QString | itemType () const |
QUrl | itemUrl () const |
bool | last () |
int | limit () const |
QVariant | metaData ( int key ) const |
QVariant | metaData ( const QString & property ) const |
bool | next () |
int | offset () const |
bool | previous () |
QGalleryProperty::Attributes | propertyAttributes ( int key ) const |
int | propertyKey ( const QString & property ) const |
QStringList | propertyNames () const |
QVariant::Type | propertyType ( int key ) const |
QList<QGalleryResource> | resources () const |
QGalleryResultSet * | resultSet () const |
QVariant | rootItem () const |
QString | rootType () const |
QGalleryQueryRequest::Scope | scope () const |
bool | seek ( int index, bool relative = false ) |
void | setAutoUpdate ( bool enabled ) |
void | setFilter ( const QGalleryFilter & filter ) |
void | setLimit ( int limit ) |
bool | setMetaData ( int key, const QVariant & value ) |
bool | setMetaData ( const QString & property, const QVariant & value ) |
void | setOffset ( int offset ) |
void | setPropertyNames ( const QStringList & names ) |
void | setRootItem ( const QVariant & itemId ) |
void | setRootType ( const QString & itemType ) |
void | setScope ( QGalleryQueryRequest::Scope scope ) |
void | setSortPropertyNames ( const QStringList & names ) |
QStringList | sortPropertyNames () const |
void | autoUpdateChanged () |
void | currentItemChanged () |
void | filterChanged () |
void | limitChanged () |
void | offsetChanged () |
void | propertyNamesChanged () |
void | resultSetChanged ( QGalleryResultSet * resultSet ) |
void | rootItemChanged () |
void | rootTypeChanged () |
void | scopeChanged () |
void | sortPropertyNamesChanged () |
virtual void | setResponse ( QGalleryAbstractResponse * response ) |
The QGalleryQueryRequest class provides a request for a set of items from a gallery.
QGalleryItemRequest executes a query which returns information about a set gallery item of gallery items matching some query criteria. For each item matching the query criteria the request will return an itemUrl, an itemType, resources and meta-data values for the properties listed in propertyNames.
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 request. The request 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 request 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 request.
Only one item in a query can be accessed at a time, so before information about an item can be accessed it must be selected using one of the fetch() functions. When a new index is selected the result set will emit the currentIndexChanged() signal, and when the currently selected item changes the currentItemChanged() signal will be emitted. If the currentIndex() contains a gallery item isValid() will return true, otherwise it will return false. Information identifying the current item in the request can be accessed using the itemId(), itemUrl() and itemType() functions.
For each meta-data property returned by a query a unique key will be provided, this cab be queried by passing the property's name to the propertyKey() function. Passing this key to the metaData() function will return the current item's value for that property. Some queries may return items with editable meta-data values which can be changed using the setMetaData() function. The attributes of a meta-data property such as whether it's writable can be queried from propertyAttributes() and the type of value that will returned by metaData() can be queried using propertyType().
See also QDocumentGallery and QGalleryQueryModel.
Identifies the scope of query.
Constant | Value | Description |
---|---|---|
QGalleryQueryRequest::AllDescendants | 0 | The query will return all descendents of the scope item. |
QGalleryQueryRequest::DirectDescendants | 1 | The query will return only direct descendents of the scope item. |
This property holds whether a the results of a request should be updated after a request has finished.
If this is true the request will go into the Idle state when the request has finished rather than returning to Inactive.
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 index of current item.
This property was introduced in Qt Mobility 1.1.
Access functions:
int | currentIndex () const |
bool | seek ( int index, bool relative = false ) |
Notifier signal:
void | currentItemChanged () |
This property holds a filter identifying the items a request should return.
If no filter is set the results of the request will be determined by the rootType and rootItem properties.
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 ID of the current item.
This property was introduced in Qt Mobility 1.1.
Access functions:
QVariant | itemId () const |
Notifier signal:
void | currentItemChanged () |
This property holds he type of the current item.
This property was introduced in Qt Mobility 1.1.
Access functions:
QString | itemType () const |
Notifier signal:
void | currentItemChanged () |
This property holds the URL of the current item.
This property was introduced in Qt Mobility 1.1.
Access functions:
QUrl | itemUrl () const |
Notifier signal:
void | currentItemChanged () |
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 a list of names of meta-data properties a request should return values for.
This property was introduced in Qt Mobility 1.1.
Access functions:
QStringList | propertyNames () const |
void | setPropertyNames ( const QStringList & names ) |
Notifier signal:
void | propertyNamesChanged () |
This property holds the resources of the current item.
This property was introduced in Qt Mobility 1.1.
Access functions:
QList<QGalleryResource> | resources () const |
Notifier signal:
void | currentItemChanged () |
This property holds the ID of an item the 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 () |
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 all descendants of the rootItem should be returned by a request or just the direct descendants.
This property was introduced in Qt Mobility 1.1.
Access functions:
QGalleryQueryRequest::Scope | scope () const |
void | setScope ( QGalleryQueryRequest::Scope scope ) |
Notifier signal:
void | scopeChanged () |
This property holds a list of names of meta-data properties a request should sort its results 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 whether the result set is currently positioned on a valid item.
This property was introduced in Qt Mobility 1.1.
Access functions:
bool | isValid () const |
Notifier signal:
void | currentItemChanged () |
Constructs a new gallery query request.
The parent is passed to QObject.
Contructs a new query request for the given gallery.
The parent is passed to QObject.
Destroys a gallery query request.
Signals that the value of autoUpdate has changed.
This function was introduced in Qt Mobility 1.1.
Signals that the item the result set is positioned on has changed.
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.
Seeks to the first item in the result set.
Returns true if the position of the result set is valid after the seek; and false otherwise.
This function was introduced in Qt Mobility 1.1.
Returns the number of items returned by a query.
This function was introduced in Qt Mobility 1.1.
Seeks to the last item in the result set.
Returns true if the position of the result set is valid after the seek; and false otherwise.
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.
Returns the value of a meta-data property identified by key for the current item.
This function was introduced in Qt Mobility 1.1.
See also setMetaData().
Returns the value of a meta-data property for the current item.
This function was introduced in Qt Mobility 1.1.
Seeks to the next item in the result set.
Returns true if the position of the result set is valid after the seek; and false otherwise.
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.
Seeks to the previous item in the result set.
Returns true if the position of the result set is valid after the seek; and false otherwise.
This function was introduced in Qt Mobility 1.1.
Returns the attributes of the property identified by key.
This function was introduced in Qt Mobility 1.1.
Returns the key of property.
This function was introduced in Qt Mobility 1.1.
Signals that the value of propertyNames has changed.
This function was introduced in Qt Mobility 1.1.
Returns the type of the property identified by key.
This function was introduced in Qt Mobility 1.1.
Returns the result set containing the results of a query.
This function was introduced in Qt Mobility 1.1.
Signals that the resultSet containing the results of a query have changed.
This function was introduced in Qt Mobility 1.1.
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.
Signals that the value of scope has changed.
This function was introduced in Qt Mobility 1.1.
Sets the value of a meta-data property identified by key for the current item.
Returns true if the value was changed; otherwise returns false.
This function was introduced in Qt Mobility 1.1.
See also metaData().
Sets the
Constant | Value | Description |
---|---|---|
QGalleryQueryRequest::of | ? | a meta-data property for the current item. |
Returns true if the value was changed; otherwise returns false.
This function was introduced in Qt Mobility 1.1.
Reimplemented from QGalleryAbstractRequest::setResponse().
This function was introduced in Qt Mobility 1.1.
Signals that the value of sortPropertyNames has changed.
This function was introduced in Qt Mobility 1.1.
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.