Qt Mobility Reference Documentation

QML DocumentGalleryModel Element

The DocumentGalleryModel element is used to specify a model containing items from the document gallery. More...

Properties

Signals

Methods

Detailed Description

This element is part of the QtMobility.gallery 1.1 module.

The properties that should be returned for each item by the query are specified in properties. In addition all queries return the following properties:

  • itemId The ID of an item.
  • itemType The type of an item.
 import Qt 4.7
 import QtMobility.gallery 1.1

 Rectangle {
     width: 1024
     height: 768

     GridView {
         anchors.fill: parent
         cellWidth: 128
         cellHeight: 128

         model: DocumentGalleryModel {
             rootType: DocumentGallery.Image
             properties: [ "url" ]
             filter: GalleryWildcardFilter {
                 property: "fileName";
                 value: "*.jpg";
             }
         }

         delegate: Image {
             source: url
             width: 128
             height: 128
         }
     }
 }

See also DocumentGalleryItem and DocumentGalleryType.


Property Documentation

autoUpdate : bool

This property holds whether a query should refresh its results automatically.


count : int

This property holds the number of results returned by a query.


filter : GalleryFilter

This property contains criteria to used to filter the results of a query.


limit : int

This property contains the maximum number of items returned by a query.


offset : int

This property holds the offset of the first item returned by a query.


progress : real

This property holds the current progress of the request, from 0.0 (started) to 1.0 (finished).


properties : QStringList

This property holds the item properties a query should return values for.


rootItem : variant

This property contains the id of an item that a query should return the descendants of.


rootType : enum

This property contains the type of item a query should return. It can be one of:

  • DocumentGallery.InvalidType
  • DocumentGallery.File
  • DocumentGallery.Folder
  • DocumentGallery.Document
  • DocumentGallery.Text
  • DocumentGallery.Audio
  • DocumentGallery.Image
  • DocumentGallery.Video
  • DocumentGallery.Playlist
  • DocumentGallery.Artist
  • DocumentGallery.AlbumArtist
  • DocumentGallery.Album
  • DocumentGallery.AudioGenre
  • DocumentGallery.PhotoAlbum

The default value is DocumentGallery.File


scope : enum

The property contains whether a query should count the direct descendants of the rootItem or all descendants.


sortProperties : QStringList

This property holds the properties the results of a query should be sorted on.


status : enum

This property holds the status of a query. It can be one of:

  • Null No query parameters have been specified.
  • Active Items matching the query parameters are being fetched from the gallery.
  • Finished The query has finished
  • Idle The query is finished and will be automatically updated as new items become available.
  • Canceling The query was canceled but hasn't yet reached the canceled status.
  • Canceled The query was canceled.
  • Error Information about a type could not be retrieved due to an error.

Signal Documentation

DocumentGalleryModel::onCanceled ()

Signals that a query was canceled.


DocumentGalleryModel::onFailed ( error )

Signals that a query failed with the given error.


DocumentGalleryModel::onFinished ( result )

Signals that a query finished with the given result.


DocumentGalleryModel::onSucceeded ()

Signals that a query has finished successfully.


Method Documentation

DocumentGalleryModel::cancel ()

Cancels an executing query.


DocumentGalleryModel::clear ()

Clears the results of a query.


DocumentGalleryModel::get ( int index )

Returns the result at index in a query model.

 query.get(0).title

DocumentGalleryModel::property ( int index, string property )

Returns the value of property from the result at index.

 query.getProperty(0, "title")

DocumentGalleryModel::reload ()

Re-queries the gallery.


DocumentGalleryModel::set ( int index, jsobject dict )

Changes the item at index in the list model with the values in dict. Properties not appearing in dict are left unchanged.


DocumentGalleryModel::setProperty ( int index, string property, variant value )

Changes the property of the result at index in a model to value.

 model.setProperty(0, "rating", 4)

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.