QtMobility Reference Documentation

QGalleryQueryModel Class Reference

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.

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.

This property was introduced in Qt Mobility 1.1.

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.

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

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.

This property was introduced in Qt Mobility 1.1.

Access functions:

QString errorString () const

Notifier signal:

void errorChanged ()

filter : QGalleryFilter

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

gallery : QAbstractGallery *

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

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

rootItem : QVariant

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

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

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.

This property was introduced in Qt Mobility 1.1.

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.

This property was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::autoUpdateChanged () [signal]

Signals that the value of autoUpdate has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::cancel ()

Cancels a query.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::canceled () [signal]

Signals that the query was canceled.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::clear ()

Clears the results of a query.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::columnCount().

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::data().

This function was introduced in Qt Mobility 1.1.

See also setData().

void QGalleryQueryModel::errorChanged () [signal]

Signals that the error and errorString properties have changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::execute ()

Executes a query.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::filterChanged () [signal]

Signals that the value of filter has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::finished () [signal]

Signals that the query has finished.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::flags().

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::galleryChanged () [signal]

Signals that the value of gallery has changed.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::headerData().

This function was introduced in Qt Mobility 1.1.

See also setHeaderData().

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

Reimplemented from QAbstractItemModel::index().

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

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

Returns the ID of the item at index.

This function was introduced in Qt Mobility 1.1.

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

Returns the type of the item at index.

This function was introduced in Qt Mobility 1.1.

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

Returns the URL of the item at index.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::limitChanged () [signal]

Signals that the value of limit has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::offsetChanged () [signal]

Signals that the value of offset has changed.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::parent().

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::removeColumn ( int index )

Removes the column at index from a query model.

This function was introduced in Qt Mobility 1.1.

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

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

This function was introduced in Qt Mobility 1.1.

See also setRoleProperties().

void QGalleryQueryModel::rootItemChanged () [signal]

Signals that the value of rootItem has changed.

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::rootTypeChanged () [signal]

Signals that the value of rootType has changed.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::rowCount().

This function was introduced in Qt Mobility 1.1.

void QGalleryQueryModel::scopeChanged () [signal]

Signals that the value of scope has changed.

This function was introduced in Qt Mobility 1.1.

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

Reimplemented from QAbstractItemModel::setData().

This function was introduced in Qt Mobility 1.1.

See also data().

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

Reimplemented from QAbstractItemModel::setHeaderData().

This function was introduced in Qt Mobility 1.1.

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.

This function was introduced in Qt Mobility 1.1.

See also roleProperties().

void QGalleryQueryModel::sortPropertyNamesChanged () [signal]

Signals that the value of sortPropertyNames has changed.

This function was introduced in Qt Mobility 1.1.

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

Signals that the state of the query has changed.

This function was introduced in Qt Mobility 1.1.

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.