Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QContentSetModel Class Reference
[QtBaseModule]

The QContentSetModel class provides a data model to represent the items in a QContentSet. More...

    #include <QContentSetModel>

Inherits QAbstractListModel.

Public Types

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QContentSetModel class provides a data model to represent the items in a QContentSet.

This class provides access to the content system information, providing extra functions for retrieving information relevant to the content set passed in the constructor.

Example usage:

    QContentSet contentset( QContentFilter::Directory, "/Documents" );
    QContentSetModel model( &contentset );

    QListView listview( this );
    listview->setModel( &model );

For a complete example that includes the use of QContentSetModel, see the Content Filtering tutorial, and the Model/View Programming documentation.


Member Type Documentation

enum QContentSetModel::ItemDataRole

Each item in the model has a set of data elements associated with it, each with its own role. The roles are used by the view to indicate to the model which type of data it needs.

QContentSetModel adds the following roles:

ConstantValueDescription
QContentSetModel::FilenameRoleQt::UserRoleThe filename of the data item to be displayed.
QContentSetModel::ContentRoleQt::UserRole + 1The QContent object of the data item to be displayed.
QContentSetModel::ThumbnailRoleQt::UserRole + 2The thumbnail if available of the data item to be displayed.

See also Qt::ItemDataRole and Qtopia::ItemDataRole.


Member Function Documentation

QContentSetModel::QContentSetModel ( const QContentSet * cls, QObject * parent = 0 )

Constructs a new model based on the QContentSet cls with parent parent.

QContentSetModel::~QContentSetModel ()   [virtual]

Destroys the QContentSetModel object.

QContent QContentSetModel::content ( uint row ) const

Returns the QContent for the requested row.

QContent QContentSetModel::content ( const QModelIndex & index ) const

This is an overloaded member function, provided for convenience.

Returns the QContent for the requested index.

QContentId QContentSetModel::contentId ( uint row ) const

Returns the QContentId for the requested row. The value returned may be QContent::InvalidId if the QContent has not been committed to the backing store, or there is no associated QContentSet for the model.

QContentId QContentSetModel::contentId ( const QModelIndex & index ) const

This is an overloaded member function, provided for convenience.

Returns the QContentId for the requested index.

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

Returns the appropriate QVariant data from the model for the given index. Depending upon the role, the QVariant will contain the name of the QContent object at that index, its icon, or relevant tooltip text. The "ToolTip" text is shown when the user hovers the cursor over the item in the model view. The tooltip text will display the comment() field from the QContent object, or if error() is true, the error text. Additionally the DRM rights in summary form will be shown.

Reimplemented from QAbstractItemModel.

QDrmRights::Permissions QContentSetModel::mandatoryPermissions () const

Returns the permissions a QContent must have in order to be selectable in the content model.

See also QDrmRights and setMandatoryPermissions().

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

Returns the number of rows in the model. Since this is a flat list the parent argument will always be the default null index, indicating a top level item. The result is the count of the items in the backing store which match the filter expression plus any explicitly added non-matching items.

Reimplemented from QAbstractItemModel.

QDrmRights::Permission QContentSetModel::selectPermission () const

Returns the permission which indicates the intended usage of the content in the model.

See also QDrmRights and setSelectPermission().

void QContentSetModel::setMandatoryPermissions ( QDrmRights::Permissions permissions )

Sets the permissions a QContent must have to in order to be selectable in the content model.

If a row in the model doesn't have all the mandatory permissions the Qt::ItemIsEnabled and Qt::ItemIsSelectable flags will be cleared.

See also QDrmRights and mandatoryPermissions().

void QContentSetModel::setSelectPermission ( QDrmRights::Permission permission )

Sets the permission which indicates the intended usage of the content in the model. Content in the model which doesn't have the selected permission will be displayed with an invalid rights icon.

If the permission is QDrmRights::InvalidPermission the default permission for the content is used.

See also QDrmRights and selectPermission().

void QContentSetModel::updateFinished ()   [signal]

Signals that an update of the contents of the set has started.

This only applies to asynchronous content sets.

See also updateInProgress() and updateStarted().

bool QContentSetModel::updateInProgress () const

Returns true if the content of the set are being updated.

This only applies to asynchronous content sets.

See also updateStarted() and updateFinished().

void QContentSetModel::updateStarted ()   [signal]

Signals that an update of the contents of the set has started.

This only applies to asynchronous content sets.

See also updateInProgress() and updateFinished().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3