Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QGalleryQueryRequest Class Reference

The QGalleryQueryRequest class provides a request for a set of items from a gallery. More...

 #include <QGalleryQueryRequest>

Inherits QGalleryAbstractRequest.

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.

ConstantValueDescription
QGalleryQueryRequest::AllDescendants0The query will return all descendents of the scope item.
QGalleryQueryRequest::DirectDescendants1The 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.

Access functions:

bool autoUpdate () const
void setAutoUpdate ( bool enabled )

Notifier signal:

void autoUpdateChanged ()

currentIndex : int

This property holds the index of current item.

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.

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.

Access functions:

QVariant itemId () const

Notifier signal:

void currentItemChanged ()

itemType : const QString

This property holds he type of the current item.

Access functions:

QString itemType () const

Notifier signal:

void currentItemChanged ()

itemUrl : const QUrl

This property holds the URL of the current item.

Access functions:

QUrl itemUrl () const

Notifier signal:

void currentItemChanged ()

limit : int

This property holds the maximum number of items a query should return.

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.

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.

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.

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.

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.

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.

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.

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.

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.

void QGalleryQueryRequest::currentItemChanged () [signal]

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

void QGalleryQueryRequest::filterChanged () [signal]

Signals that the value of filter has changed.

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.

int QGalleryQueryRequest::itemCount () const

Returns the number of items returned by a query.

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.

void QGalleryQueryRequest::limitChanged () [signal]

Signals that the value of limit has changed.

QVariant QGalleryQueryRequest::metaData ( int key ) const

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

See also setMetaData().

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

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

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.

void QGalleryQueryRequest::offsetChanged () [signal]

Signals that the value of offset has changed.

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.

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

Returns the attributes of the property identified by key.

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

Returns the key of property.

void QGalleryQueryRequest::propertyNamesChanged () [signal]

Signals that the value of propertyNames has changed.

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

Returns the type of the property identified by key.

QGalleryResultSet * QGalleryQueryRequest::resultSet () const

Returns the result set containing the results of a query.

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

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

void QGalleryQueryRequest::rootItemChanged () [signal]

Signals that the value of rootItem has changed.

void QGalleryQueryRequest::rootTypeChanged () [signal]

Signals that the value of rootType has changed.

void QGalleryQueryRequest::scopeChanged () [signal]

Signals that the value of scope has changed.

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.

See also metaData().

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

Sets the

ConstantValueDescription
QGalleryQueryRequest::of?a meta-data property for the current item.

Returns true if the value was changed; otherwise returns false.

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

Reimplemented from QGalleryAbstractRequest::setResponse().

void QGalleryQueryRequest::sortPropertyNamesChanged () [signal]

Signals that the value of sortPropertyNames has changed.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. Microsoft ouvre aux autres compilateurs C++ AMP, la spécification pour la conception d'applications parallèles C++ utilisant le GPU 22
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. RIM : « 13 % des développeurs ont gagné plus de 100 000 $ sur l'AppWord », Qt et open-source au menu du BlackBerry DevCon Europe 0
  4. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 12
  5. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
Page suivante

Le Qt Developer Network au hasard

Logo

Utiliser QML et QtWebKit avec PySide

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.1
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web