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

QPimSourceModel Class Reference
[QtMessagingModule, QtPimModule, QtTelephonyModule, QtUiModule]

The QPimSourceModel class provides a Model class for manipulating a set of QPimSource objects. More...

    #include <QPimSourceModel>

Inherits QAbstractListModel.

Public Functions

Additional Inherited Members


Detailed Description

The QPimSourceModel class provides a Model class for manipulating a set of QPimSource objects.

This is intended to be used with a QAbstractItemView derived class like QListView, in order to provide the user with a way to select a source (or sources) for their PIM data. It provides sorting of the sources, accessing translated strings for source titles, and the ability to check and uncheck sources for use with one of the PIM models (QContactModel, QTaskModel and QAppointmentModel).

By default, this model will provide a non-checkable model, suitable for selecting a single source, but if setCheckedSources() is called this model will allow for multiple sources to be selected.

See also QPimModel, QPimContext, and Pim Library.


Member Function Documentation

QPimSourceModel::QPimSourceModel ( QWidget * parent = 0 )

Constructs a QPimSourceModel with parent parent.

QPimSourceModel::~QPimSourceModel ()

Destroys the QPimSourceModel.

void QPimSourceModel::addSource ( const QPimSource & source )

Adds the PIM data source to the model

See also removeSource() and updateSource().

QSet<QPimSource> QPimSourceModel::checkedSources () const

Returns the set of checked sources.

See also setCheckedSources().

QPimContext * QPimSourceModel::context ( const QModelIndex & index ) const

Returns the context that controls the PIM data source at index. Returns 0 if no context controlling the PIM data source is found, or if the index is invalid.

See also source().

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

Returns the data stored under the given role for the item referred to by the index.

This function will return the QPimSource's title for role Qt::DisplayRole, the icon for the corresponding QPimContext for role Qt::DecorationRole, and the appropriate check state for Qt::CheckStateRole.

Reimplemented from QAbstractItemModel.

See also setData().

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

Returns the item flags for the given index.

If setCheckedSources() has been called, these flags will include Qt::ItemIsUserCheckable, as a hint to the view to provide multiple selection capabilities.

Reimplemented from QAbstractItemModel.

QModelIndex QPimSourceModel::index ( const QPimSource & source ) const

Returns the index for this model that corresponds to the PIM data source. Returns a null index if the source is not listed in the model.

void QPimSourceModel::removeSource ( const QPimSource & source )

Removes the PIM data source from the model.

See also addSource() and updateSource().

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

Returns the number of rows in the model. The parameter parent is not used.

Reimplemented from QAbstractItemModel.

void QPimSourceModel::setCheckedSources ( const QSet<QPimSource> & set )

Sets the sources that should be marked as checked to those contained in set. Calling this function will also indicate that this model should allow multiple selections.

Typically, this function will be called with the results from QPimModel::visibleSources().

See also checkedSources().

void QPimSourceModel::setContexts ( const QList<QPimContext *> & contexts )

Sets the contexts defining the PIM data sources to display to contexts The available sources for each context are built into a list of PIM data sources.

Typically, the list of contexts is provided by QPimModel::contexts().

void QPimSourceModel::setContexts ( const QList<QContactContext *> & contexts )

This is an overloaded member function, provided for convenience.

This is a convenience function for the contexts of a QContactModel.

void QPimSourceModel::setContexts ( const QList<QAppointmentContext *> & contexts )

This is an overloaded member function, provided for convenience.

This is a convenience function for the contexts of a QAppointmentModel.

void QPimSourceModel::setContexts ( const QList<QTaskContext *> & contexts )

This is an overloaded member function, provided for convenience.

This is a convenience function for the contexts of a QTaskModel.

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

Sets the role data for the item at index to value. Returns true if successful, otherwise returns false.

In this implementation only the data for the Qt::CheckStateRole can be modified this way.

Reimplemented from QAbstractItemModel.

See also data().

QPimSource QPimSourceModel::source ( const QModelIndex & index ) const

Returns the PIM data source at index.

See also context().

void QPimSourceModel::updateSource ( const QModelIndex & index, const QPimSource & source )

Updates the PIM data source at index to source. Because the model maintains a sort order, the new source may not appear at index.

See also addSource() and removeSource().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3