MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QGalleryQueryRequest Class Reference

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.

Public Types

enum Scope { AllDescendants, DirectDescendants }

Properties

Public Functions

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

Signals

void autoUpdateChanged ()
void currentItemChanged ()
void filterChanged ()
void limitChanged ()
void offsetChanged ()
void propertyNamesChanged ()
void resultSetChanged ( QGalleryResultSet * resultSet )
void rootItemChanged ()
void rootTypeChanged ()
void scopeChanged ()
void sortPropertyNamesChanged ()

Reimplemented Protected Functions

virtual void setResponse ( QGalleryAbstractResponse * response )

Additional Inherited Members

Detailed Description

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.

Member Type Documentation

enum QGalleryQueryRequest::Scope

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.

Property Documentation

autoUpdate : bool

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 ()

currentIndex : int

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 ()

filter : QGalleryFilter

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 ()

itemId : const QVariant

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 ()

itemType : const QString

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 ()

itemUrl : const QUrl

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 ()

limit : int

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 ()

offset : int

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 ()

propertyNames : QStringList

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 ()

resources : const QList<QGalleryResource>

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 ()

rootItem : QVariant

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 ()

rootType : QString

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 ()

scope : QGalleryQueryRequest::Scope

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 ()

sortPropertyNames : QStringList

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 ()

valid : const bool

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 ()

Member Function Documentation

QGalleryQueryRequest::QGalleryQueryRequest ( QObject * parent = 0 )

Constructs a new gallery query request.

The parent is passed to QObject.

QGalleryQueryRequest::QGalleryQueryRequest ( QAbstractGallery * gallery, QObject * parent = 0 )

Contructs a new query request for the given gallery.

The parent is passed to QObject.

QGalleryQueryRequest::~QGalleryQueryRequest ()

Destroys a gallery query request.

void QGalleryQueryRequest::autoUpdateChanged () [signal]

Signals that the value of autoUpdate has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::currentItemChanged () [signal]

Signals that the item the result set is positioned on has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::filterChanged () [signal]

Signals that the value of filter has changed.

This function was introduced in Qt Mobility 1.1.

bool QGalleryQueryRequest::first ()

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.

int QGalleryQueryRequest::itemCount () const

Returns the number of items returned by a query.

This function was introduced in Qt Mobility 1.1.

bool QGalleryQueryRequest::last ()

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.

void QGalleryQueryRequest::limitChanged () [signal]

Signals that the value of limit has changed.

This function was introduced in Qt Mobility 1.1.

QVariant QGalleryQueryRequest::metaData ( int key ) const

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().

QVariant QGalleryQueryRequest::metaData ( const QString & property ) const

Returns the value of a meta-data property for the current item.

This function was introduced in Qt Mobility 1.1.

bool QGalleryQueryRequest::next ()

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.

void QGalleryQueryRequest::offsetChanged () [signal]

Signals that the value of offset has changed.

This function was introduced in Qt Mobility 1.1.

bool QGalleryQueryRequest::previous ()

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.

QGalleryProperty::Attributes QGalleryQueryRequest::propertyAttributes ( int key ) const

Returns the attributes of the property identified by key.

This function was introduced in Qt Mobility 1.1.

int QGalleryQueryRequest::propertyKey ( const QString & property ) const

Returns the key of property.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::propertyNamesChanged () [signal]

Signals that the value of propertyNames has changed.

This function was introduced in Qt Mobility 1.1.

QVariant::Type QGalleryQueryRequest::propertyType ( int key ) const

Returns the type of the property identified by key.

This function was introduced in Qt Mobility 1.1.

QGalleryResultSet * QGalleryQueryRequest::resultSet () const

Returns the result set containing the results of a query.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::resultSetChanged ( QGalleryResultSet * resultSet ) [signal]

Signals that the resultSet containing the results of a query have changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::rootItemChanged () [signal]

Signals that the value of rootItem has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::rootTypeChanged () [signal]

Signals that the value of rootType has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::scopeChanged () [signal]

Signals that the value of scope has changed.

This function was introduced in Qt Mobility 1.1.

bool QGalleryQueryRequest::setMetaData ( int key, const QVariant & value )

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().

bool QGalleryQueryRequest::setMetaData ( const QString & property, const QVariant & value )

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.

void QGalleryQueryRequest::setResponse ( QGalleryAbstractResponse * response ) [virtual protected]

Reimplemented from QGalleryAbstractRequest::setResponse().

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryRequest::sortPropertyNamesChanged () [signal]

Signals that the value of sortPropertyNames has changed.

This function was introduced in Qt Mobility 1.1.