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  · 

QGalleryQueryModel Class Reference

The QGalleryQueryModel class provides a model for the results of a gallery query. More...

 #include <QGalleryQueryModel>

Inherits QAbstractItemModel.

Properties

  • 1 property inherited from QObject

Public Functions

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

Reimplemented Public Functions

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 )

Signals

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 )

Additional Inherited Members

Detailed Description

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.

Property Documentation

autoUpdate : bool

This property holds whether a query should continue to update its result set after the initial query succeeded.

Access functions:

bool autoUpdate () const
void setAutoUpdate ( bool enabled )

Notifier signal:

void autoUpdateChanged ()

error : const int

This property holds the error encountered by an unsuccessful query.

Access functions:

int error () const
void error ( int error, const QString & errorString )

Notifier signal:

void errorChanged ()

errorString : const QString

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.

Access functions:

QString errorString () const

Notifier signal:

void errorChanged ()

filter : QGalleryFilter

This property holds a filter restricting the results of a query.

Access functions:

QGalleryFilter filter () const
void setFilter ( const QGalleryFilter & filter )

Notifier signal:

void filterChanged ()

gallery : QAbstractGallery *

This property holds the Gallery a model executes its queries against.

Access functions:

QAbstractGallery * gallery () const
void setGallery ( QAbstractGallery * gallery )

Notifier signal:

void galleryChanged ()

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

rootItem : QVariant

This property holds the ID of the item a query should return the descendents of.

Access functions:

QVariant rootItem () const
void setRootItem ( const QVariant & itemId )

Notifier signal:

void rootItemChanged ()

See also scope().

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 a query will return all descendents of its root item or just the direct decendents.

Access functions:

QGalleryQueryRequest::Scope scope () const
void setScope ( QGalleryQueryRequest::Scope scope )

Notifier signal:

void scopeChanged ()

See also rootItem().

sortPropertyNames : QStringList

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.

Access functions:

QStringList sortPropertyNames () const
void setSortPropertyNames ( const QStringList & names )

Notifier signal:

void sortPropertyNamesChanged ()

state : const QGalleryAbstractRequest::State

This property holds the state of a query.

Access functions:

QGalleryAbstractRequest::State state () const

Notifier signal:

void stateChanged ( QGalleryAbstractRequest::State state )

Member Function Documentation

QGalleryQueryModel::QGalleryQueryModel ( QObject * parent = 0 )

Constructs a new query model.

The parent is passed to QAbstractItemModel.

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

Constructs a new model which queries items from a gallery.

The parent is passed to QAbstractItemModel.

QGalleryQueryModel::~QGalleryQueryModel ()

void QGalleryQueryModel::addColumn ( const QHash<int, QString> & properties )

Adds a column which maps the given properties to a query model.

The column will not be populated until the query is executed.

void QGalleryQueryModel::addColumn ( const QString & property, int role = Qt::DisplayRole )

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.

void QGalleryQueryModel::autoUpdateChanged () [signal]

Signals that the value of autoUpdate has changed.

void QGalleryQueryModel::cancel ()

Cancels a query.

void QGalleryQueryModel::canceled () [signal]

Signals that the query was canceled.

void QGalleryQueryModel::clear ()

Clears the results of a query.

int QGalleryQueryModel::columnCount ( const QModelIndex & parent = QModelIndex() ) const [virtual]

Reimplemented from QAbstractItemModel::columnCount().

QVariant QGalleryQueryModel::data ( const QModelIndex & index, int role = Qt::DisplayRole ) const [virtual]

Reimplemented from QAbstractItemModel::data().

See also setData().

void QGalleryQueryModel::errorChanged () [signal]

Signals that the error and errorString properties have changed.

void QGalleryQueryModel::execute ()

Executes a query.

void QGalleryQueryModel::filterChanged () [signal]

Signals that the value of filter has changed.

void QGalleryQueryModel::finished () [signal]

Signals that the query has finished.

Qt::ItemFlags QGalleryQueryModel::flags ( const QModelIndex & index ) const [virtual]

Reimplemented from QAbstractItemModel::flags().

void QGalleryQueryModel::galleryChanged () [signal]

Signals that the value of gallery has changed.

QVariant QGalleryQueryModel::headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const [virtual]

Reimplemented from QAbstractItemModel::headerData().

See also setHeaderData().

QModelIndex QGalleryQueryModel::index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const [virtual]

Reimplemented from QAbstractItemModel::index().

void QGalleryQueryModel::insertColumn ( int index, const QHash<int, QString> & properties )

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.

void QGalleryQueryModel::insertColumn ( int index, const QString & property, int role = Qt::DisplayRole )

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.

QVariant QGalleryQueryModel::itemId ( const QModelIndex & index ) const

Returns the ID of the item at index.

QString QGalleryQueryModel::itemType ( const QModelIndex & index ) const

Returns the type of the item at index.

QUrl QGalleryQueryModel::itemUrl ( const QModelIndex & index ) const

Returns the URL of the item at index.

void QGalleryQueryModel::limitChanged () [signal]

Signals that the value of limit has changed.

void QGalleryQueryModel::offsetChanged () [signal]

Signals that the value of offset has changed.

QModelIndex QGalleryQueryModel::parent ( const QModelIndex & index ) const [virtual]

Reimplemented from QAbstractItemModel::parent().

void QGalleryQueryModel::removeColumn ( int index )

Removes the column at index from a query model.

QHash<int, QString> QGalleryQueryModel::roleProperties ( int column ) const

Returns the meta-data properties which a column maps to roles.

See also setRoleProperties().

void QGalleryQueryModel::rootItemChanged () [signal]

Signals that the value of rootItem has changed.

void QGalleryQueryModel::rootTypeChanged () [signal]

Signals that the value of rootType has changed.

int QGalleryQueryModel::rowCount ( const QModelIndex & parent = QModelIndex() ) const [virtual]

Reimplemented from QAbstractItemModel::rowCount().

void QGalleryQueryModel::scopeChanged () [signal]

Signals that the value of scope has changed.

bool QGalleryQueryModel::setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ) [virtual]

Reimplemented from QAbstractItemModel::setData().

See also data().

bool QGalleryQueryModel::setHeaderData ( int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole ) [virtual]

Reimplemented from QAbstractItemModel::setHeaderData().

See also headerData().

void QGalleryQueryModel::setRoleProperties ( int column, const QHash<int, QString> & properties )

Sets the meta-data properties which a column maps to roles.

New properties will not be populated until the query is executed.

See also roleProperties().

void QGalleryQueryModel::sortPropertyNamesChanged () [signal]

Signals that the value of sortPropertyNames has changed.

void QGalleryQueryModel::stateChanged ( QGalleryAbstractRequest::State state ) [signal]

Signals that the state of the query 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. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 43
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
Page suivante

Le blog Digia au hasard

Logo

Une nouvelle ère d'IHM 3D pour les automobiles

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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