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  · 

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

The QAppointmentModel class provides access to the Calendar data. More...

    #include <QAppointmentModel>

Inherits QPimModel.

Public Types

Public Functions

  • QAppointmentModel ( QObject * parent = 0 )
  • QUniqueId addAppointment ( const QAppointment & appointment, const QPimSource & source = QPimSource() )
  • virtual QUniqueId addRecord ( const QByteArray & bytes, const QPimSource & source, const QString & format = QString() )
  • QAppointment appointment ( const QModelIndex & index ) const
  • QAppointment appointment ( const QUniqueId & identifier ) const
  • QAppointment appointment ( int row ) const
  • virtual QVariant data ( const QModelIndex & index, int role ) const
  • DurationType durationType () const
  • QDateTime rangeEnd () const
  • QDateTime rangeStart () const
  • virtual QByteArray record ( const QUniqueId & identifier, const QString & format = QString() ) const
  • bool removeAppointment ( const QAppointment & appointment )
  • bool removeAppointment ( const QUniqueId & identifier )
  • bool removeList ( const QList<QUniqueId> & identifiers )
  • bool removeOccurrence ( const QOccurrence & occurrence )
  • bool removeOccurrence ( const QAppointment & appointment, const QDate & date )
  • bool removeOccurrence ( const QUniqueId & identifier, const QDate & date )
  • virtual bool removeRecord ( const QUniqueId & identifier )
  • QUniqueId replaceOccurrence ( const QAppointment & appointment, const QOccurrence & occurrence, const QDate & date = QDate() )
  • QUniqueId replaceRemaining ( const QAppointment & appointment, const QAppointment & replacement, const QDate & date = QDate() )
  • bool restoreOccurrence ( const QUniqueId & identifier, const QDate & date )
  • virtual bool setData ( const QModelIndex & index, const QVariant & value, int role )
  • void setDurationType ( DurationType type )
  • void setRange ( const QDateTime & start, const QDateTime & end )
  • bool updateAppointment ( const QAppointment & appointment )
  • virtual bool updateRecord ( const QUniqueId & id, const QByteArray & bytes, const QString & format = QString() )

Static Public Members

  • 4 static public members inherited from QObject

Additional Inherited Members


Detailed Description

The QAppointmentModel class provides access to the Calendar data.

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

The appointment 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 any custom views.

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

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

See also QAppointment, QSortFilterProxyModel, and Pim Library.


Member Type Documentation

enum QAppointmentModel::DurationType

Describes the set of occurrences that should be shown by the model

ConstantValueDescription
QAppointmentModel::TimedDuration0x01Occurrences that have times and dates specified for when they start and end.
QAppointmentModel::AllDayDuration0x2Occurrences that only have a date specified for when they start and end.
QAppointmentModel::AnyDurationTimedDuration | AllDayDurationOccurrences with either date only or date and time specified for when they start and end.

enum QAppointmentModel::Field

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

ConstantValueDescription
QAppointmentModel::Invalid-1An invalid field
QAppointmentModel::Description0The description of the appointment
QAppointmentModel::Location1The location of the appointment
QAppointmentModel::Start2The start time of the appointment
QAppointmentModel::End3The end time of the appointment
QAppointmentModel::AllDay4Whether the appointment is an all day event
QAppointmentModel::TimeZone5The time zone of the appointment
QAppointmentModel::Notes6The notes of the appointment
QAppointmentModel::Alarm7The type of alarm of the appointment
QAppointmentModel::RepeatRule8The repeat rule of the appointment
QAppointmentModel::RepeatFrequency9The repeat frequency of the appointment
QAppointmentModel::RepeatEndDate10The date a repeating appointment repeats until. If null the appointment repeats forever
QAppointmentModel::RepeatWeekFlags11The flags specifying what days of the week the appointment repeats on
QAppointmentModel::Identifier12The identifier of the appointment
QAppointmentModel::Categories13The list of categories the appointment belongs to

enum QAppointmentModel::QAppointmentModelRole

Extends Qt::ItemDataRole

ConstantValueDescription
QAppointmentModel::LabelRoleQt::UserRoleA short formatted text label of the appointments name.


Member Function Documentation

QAppointmentModel::QAppointmentModel ( QObject * parent = 0 )

Constructs an appointment model with the given parent.

QAppointmentModel::~QAppointmentModel ()   [virtual]

Destroys the appointment model.

QUniqueId QAppointmentModel::addAppointment ( const QAppointment & appointment, const QPimSource & source = QPimSource() )

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

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

Note the current identifier of the specified appointment is ignored.

QUniqueId QAppointmentModel::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 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 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 appointment data can be added using a appointment model. Valid formats are "vCalendar" or an empty string.

Reimplemented from QPimModel.

See also addAppointment().

QAppointment QAppointmentModel::appointment ( const QModelIndex & index ) const

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

QAppointment QAppointmentModel::appointment ( const QUniqueId & identifier ) const

This is an overloaded member function, provided for convenience.

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

QAppointment QAppointmentModel::appointment ( int row ) const

This is an overloaded member function, provided for convenience.

Returns the appointment for given row.

QVariant QAppointmentModel::appointmentField ( const QAppointment & appointment, QAppointmentModel::Field field )   [static]

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

See also setAppointmentField() and data().

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

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

Reimplemented from QAbstractItemModel.

See also setData().

DurationType QAppointmentModel::durationType () const

Returns the duration type of appointments currently included in the model.

See also setDurationType().

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

Returns a icon representing the appointment model field.

Returns a null icon if no icon is available.

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

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

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

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

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

Returns a translated string describing the appointment model field.

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

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

Returns the appointment model field for the non-translated field identifier

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

QDateTime QAppointmentModel::rangeEnd () const

Returns the end of the range filter for the model A null date time will be returned if there is no restriction on the range end.

See also setRange().

QDateTime QAppointmentModel::rangeStart () const

Returns the start of the range filter for the model. A null date time will be returned if there is no restriction on the range start.

See also setRange().

QByteArray QAppointmentModel::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 appointment().

bool QAppointmentModel::removeAppointment ( const QAppointment & appointment )

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

Returns true if a appointment was successfully removed.

bool QAppointmentModel::removeAppointment ( const QUniqueId & identifier )

This is an overloaded member function, provided for convenience.

Removes the appointment from the model with the specified identifier.

Returns true if a appointment was successfully removed.

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

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

Returns true if appointments were successfully removed. Otherwise returns false.

bool QAppointmentModel::removeOccurrence ( const QOccurrence & occurrence )

Updates the appointment in the model with the same identifier as the specified occurrence to have an exception on the date of the occurrence.

Returns true if the exception was successfully added.

bool QAppointmentModel::removeOccurrence ( const QAppointment & appointment, const QDate & date )

This is an overloaded member function, provided for convenience.

Updates the appointment in the model with the same identifier as the specified appointment to have an exception on the specified date.

Returns true if the exception was successfully added.

bool QAppointmentModel::removeOccurrence ( const QUniqueId & identifier, const QDate & date )

This is an overloaded member function, provided for convenience.

Updates the appointment in the model with the specified identifier to have an exception on the specified date.

Returns true if the appointment was successfully updated.

bool QAppointmentModel::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 removeAppointment().

QUniqueId QAppointmentModel::replaceOccurrence ( const QAppointment & appointment, const QOccurrence & occurrence, const QDate & date = QDate() )

Updates the appointment in the model with the same identifier as the specified appointment to have an exception on the specified date. The occurrence will be added as a child occurrence of the modified appointment. If the specified date is null, the start date of the occurrence will be used to create the exception.

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

QUniqueId QAppointmentModel::replaceRemaining ( const QAppointment & appointment, const QAppointment & replacement, const QDate & date = QDate() )

Updates the appointment in the model with the same identifier as the specified appointment to no longer repeat on or after the specified date. If the specified date is null, the start date of the replacement will be used. The replacement appointment will be added to the model.

Returns a valid identifier for the replacement appointment if the model was successfully modified. Otherwise returns a null identifier.

bool QAppointmentModel::restoreOccurrence ( const QUniqueId & identifier, const QDate & date )

If an recurring appointment in the model with the specified identifier has an exception listed for the given date, restores the original occurrence for that date. If the exception included a replacement appointment will also remove the replacement.

Returns true if the appointment was successfully updated.

bool QAppointmentModel::setAppointmentField ( QAppointment & appointment, QAppointmentModel::Field field, const QVariant & value )   [static]

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

Returns true if the appointment was modified.

See also appointmentField() and setData().

bool QAppointmentModel::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 appointment model only accepts data for the EditRole. The column of the specified index specifies the QAppointmentModel::Field to set and the row of the index specifies which appointment to modify.

Reimplemented from QAbstractItemModel.

See also data() and setAppointmentField().

void QAppointmentModel::setDurationType ( DurationType type )

Sets the model to only contain appointments of the specified duration type

See also durationType().

void QAppointmentModel::setRange ( const QDateTime & start, const QDateTime & end )

Sets the occurrence model to contain only occurrences that end on or after the specified range start time and start before the specified range end time. Both start and end time specified should be in local time.

bool QAppointmentModel::updateAppointment ( const QAppointment & appointment )

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

Returns true if a appointment was successfully updated.

bool QAppointmentModel::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.

Reimplemented from QPimModel.

See also updateAppointment().

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