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  · 

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

The QTaskModel class provides access to Tasks data. More...

    #include <QTaskModel>

Inherits QPimModel.

Public Types

  • enum Field { Invalid, Description, Priority, Completed, ..., RepeatWeekFlags }

Public Functions

  • QTaskModel ( QObject * parent = 0 )
  • virtual ~QTaskModel ()
  • virtual QUniqueId addRecord ( const QByteArray & bytes, const QPimSource & source, const QString & format = QString() )
  • QUniqueId addTask ( const QTask & task, const QPimSource & source = QPimSource() )
  • virtual QVariant data ( const QModelIndex & index, int role ) const
  • bool filterCompleted () const
  • QModelIndexList match ( const QModelIndex & start, int role, const QVariant & value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const
  • virtual QByteArray record ( const QUniqueId & identifier, const QString & format = QString() ) const
  • bool removeList ( const QList<QUniqueId> & identifiers )
  • virtual bool removeRecord ( const QUniqueId & identifier )
  • bool removeTask ( const QTask & task )
  • bool removeTask ( const QUniqueId & identifier )
  • virtual bool setData ( const QModelIndex & index, const QVariant & value, int role )
  • void setFilterCompleted ( bool completedOnly )
  • virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder )
  • QTask task ( const QModelIndex & index ) const
  • QTask task ( const QUniqueId & identifier ) const
  • QTask task ( int row ) const
  • virtual bool updateRecord ( const QUniqueId & id, const QByteArray & bytes, const QString & format = QString() )
  • bool updateTask ( const QTask & task )

Static Public Members

  • 4 static public members inherited from QObject

Additional Inherited Members


Detailed Description

The QTaskModel class provides access to Tasks data.

User tasks are represented in the task model as a table, with each row corresponding to a particular task and each column as on of the fields of the task. Complete QTask objects can be retrieved using the task() function which takes either a row, index, or unique identifier.

The task model is a descendant of QAbstractItemModel, so it is suitable for use with the Qt View classes such as QListView and QTableView, as well as QTaskListView or any custom views.

The task model provides functions for filtering of tasks by category and completion status, and by default will sort by completion status, priority and description. Note that this sort order may change in future versions of Qtopia.

The appointment model provides functions for sorting and some filtering of items. For filters or sorting that is not provided by the task model, it is recommended that QSortFilterProxyModel be used to wrap the task model.

A QTaskModel instance will also reflect changes made in other instances of QTaskModel, both within this application and from other applications. This will result in the modelReset() signal being emitted.

See also QTask, QTaskListView, QSortFilterProxyModel, and Pim Library.


Member Type Documentation

enum QTaskModel::Field

Enumerates the columns when in table mode and columns used for sorting. This is a subset of the data retrievable from a QTask.

ConstantValueDescription
QTaskModel::Invalid-1An invalid field
QTaskModel::Description0The description of the task
QTaskModel::Priority1The priority of the task
QTaskModel::Completed2Whether the task is completed
QTaskModel::PercentCompleted3The percent completed of the task
QTaskModel::Status4The status of the task
QTaskModel::DueDate5The due date of the task
QTaskModel::StartedDate6The started date of the task
QTaskModel::CompletedDate7The completed date of the task
QTaskModel::Notes8The notes of the task
QTaskModel::Identifier9The identifier of the task
QTaskModel::Categories10The list of categories the task belongs to
QTaskModel::Alarm11The type of alarm of the task, if it has a due date
QTaskModel::RepeatRule12The repeat rule of the task, if it has a due date
QTaskModel::RepeatFrequency14The repeat frequency of the task, if it has a due date
QTaskModel::RepeatEndDate13The date a repeating task repeats until, if it has a due date. If null the task repeats forever
QTaskModel::RepeatWeekFlags15The flags specifying what days of the week the task repeats on, if it has a due date.


Member Function Documentation

QTaskModel::QTaskModel ( QObject * parent = 0 )

Constructs a task model with the given parent.

QTaskModel::~QTaskModel ()   [virtual]

Destroys the task model.

QUniqueId QTaskModel::addRecord ( const QByteArray & bytes, const QPimSource & source, const QString & format = QString() )   [virtual]

Adds the PIM record encoded in bytes to the model under the specified storage source. The format of the record in bytes is given by format. An empty format string will cause the record to be read using the data stream operators for the PIM data type of the model. If the specified source is null the function will add the record to the default storage source.

Returns a valid identifier for the record if the record was successfully added. Otherwise returns a null identifier.

Can only add PIM data that is represented by the model. This means that only task data can be added using a task model. Valid formats are "vCalendar" or an empty string.

Reimplemented from QPimModel.

See also addTask().

QUniqueId QTaskModel::addTask ( const QTask & task, const QPimSource & source = QPimSource() )

Adds the task to the model under the specified storage source. If source is null the function will add the task to the default storage source.

Returns a valid identifier for the task if the task was successfully added. Otherwise returns a null identifier.

Note the current identifier of the specified appointment is ignored.

QVariant QTaskModel::data ( const QModelIndex & index, int role ) const   [virtual]

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

The row of the index specifies which task to access and the column of the index is treated as a QTaskModel::Field.

Reimplemented from QAbstractItemModel.

See also setData() and taskField().

QIcon QTaskModel::fieldIcon ( Field field )   [static]

Returns an icon representing the task model field.

Returns a null icon if no icon is available.

See also fieldLabel(), fieldIdentifier(), and identifierField().

QString QTaskModel::fieldIdentifier ( Field field )   [static]

Returns a non-translated string describing the task model field.

See also fieldLabel(), fieldIcon(), and identifierField().

QString QTaskModel::fieldLabel ( Field field )   [static]

Returns a translated string describing the task model field.

See also fieldIcon(), fieldIdentifier(), and identifierField().

bool QTaskModel::filterCompleted () const

Returns true if the model contains only completed tasks.

See also setFilterCompleted().

Field QTaskModel::identifierField ( const QString & identifier )   [static]

Returns the task model field for the non-translated field identifier.

See also fieldLabel(), fieldIcon(), and fieldIdentifier().

QModelIndexList QTaskModel::match ( const QModelIndex & start, int role, const QVariant & value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const

Returns a list of indexes for the items where the data matches the specified value. The list that is returned may be empty. The search starts from the start index.

Currently unimplemented, this function ignores start, role, value, hits and flags.

QByteArray QTaskModel::record ( const QUniqueId & identifier, const QString & format = QString() ) const   [virtual]

Returns the record in the model with the specified identifier encoded in the format specified by the format string. An empty format string will cause the record to be written using the data stream operators for the PIM data type of the model.

Valid formats are "vCalendar" or an empty string.

Reimplemented from QPimModel.

See also task().

bool QTaskModel::removeList ( const QList<QUniqueId> & identifiers )

Removes the records in the model specified by the list of identifiers.

Returns true if tasks were successfully removed.

bool QTaskModel::removeRecord ( const QUniqueId & identifier )   [virtual]

Removes the record from the model with the specified identifier.

Returns true if the record was successfully removed.

Reimplemented from QPimModel.

See also removeTask().

bool QTaskModel::removeTask ( const QTask & task )

Removes the task from the model with the same identifier as the specified task.

Returns true if the task was successfully removed.

bool QTaskModel::removeTask ( const QUniqueId & identifier )

This is an overloaded member function, provided for convenience.

Removes the task from the model with the specified identifier.

Returns true if the task was successfully removed.

bool QTaskModel::setData ( const QModelIndex & index, const QVariant & value, int role )   [virtual]

Sets the role data for the item at index to value. Returns true if successful.

The task model only accepts data for the EditRole. The column of the specified index specifies the QTaskModel::Field to set and the row of the index specifies which task to modify.

Reimplemented from QAbstractItemModel.

See also data() and setTaskField().

void QTaskModel::setFilterCompleted ( bool completedOnly )

Sets whether the model contains only completed Tasks to completedOnly.

See also filterCompleted().

bool QTaskModel::setTaskField ( QTask & task, QTaskModel::Field field, const QVariant & value )   [static]

Sets the value for the specified field of the given task to value.

Returns true if the task was modified.

See also taskField() and setData().

void QTaskModel::sort ( int column, Qt::SortOrder order = Qt::AscendingOrder )   [virtual]

Sorts the model by column in ascending order

Currently order is ignored but may be implemented at a future date.

Reimplemented from QAbstractItemModel.

QTask QTaskModel::task ( const QModelIndex & index ) const

Returns the task for the row specified by index. The column of index is ignored.

QTask QTaskModel::task ( const QUniqueId & identifier ) const

This is an overloaded member function, provided for convenience.

Returns the task in the model with the given identifier. The task does not have to be in the current filter mode for it to be returned.

QTask QTaskModel::task ( int row ) const

This is an overloaded member function, provided for convenience.

Return the task for the given row.

QVariant QTaskModel::taskField ( const QTask & task, QTaskModel::Field field )   [static]

Returns the value for the specified field of the given task.

Note: Certain fields (Alarm, RepeatRule, RepeatFrequency, RepeatEndDate and RepeatWeekFlags) are not accessible by this function. Use data() instead, or fetch the dependent QAppointment directly.

See also setTaskField() and data().

bool QTaskModel::updateRecord ( const QUniqueId & id, const QByteArray & bytes, const QString & format = QString() )   [virtual]

Updates the corresponding record in the model to equal the record encoded in bytes. The format of the record in bytes is given by the format string. An empty format string will cause the record to be read using the data stream operators for the PIM data type of the model. If id is not null will set the record identifier to id before attempting to update the record.

Returns true if the record was successfully updated.

Valid formats are "vCalendar" or an empty string.

Reimplemented from QPimModel.

See also updateTask().

bool QTaskModel::updateRecurringTasks ()

This function will update any recurring tasks that require updating (for example, to set the new due date). This should be called in response to the QCop message "Tasks::updateRecurringTasks()", or when the application wants to ensure that all recurring tasks are up to date.

The library will generate the QCop message at the appropriate times.

Returns true if updates were successful, false otherwise.

bool QTaskModel::updateTask ( const QTask & task )

Updates the task in the model with the same identifier as the specified task to equal the specified task.

Returns true if the task was successfully updated.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 69
  2. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 27
  3. Une nouvelle ère d'IHM 3D pour les automobiles, un concept proposé par Digia et implémenté avec Qt 3
  4. Qt Creator 2.5 est sorti en beta, l'EDI supporte maintenant plus de fonctionnalités de C++11 2
  5. Vingt sociétés montrent leurs décodeurs basés sur Qt au IPTV World Forum, en en exploitant diverses facettes (déclaratif, Web, widgets) 0
  6. PySide devient un add-on Qt et rejoint le Qt Project et le modèle d'open gouvernance 1
  7. Thread travailleur avec Qt en utilisant les signaux et les slots, un article de Christophe Dumez traduit par Thibaut Cuvelier 1
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 101
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 51
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 69
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 27
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 229
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
  7. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 101
Page suivante

Le Qt Labs au hasard

Logo

Vue d'ensemble

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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 qtextended4.4
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