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  · 

QML MessageModel Element

The MessageModel element provides access to messages. More...

  • List of all members, including inherited members
  • Properties

    Signals

    Methods

    Detailed Description

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

    MessageModel provides a model of messages from the message store. The contents of the model can be specified via a filter, and sorted via the sortBy and sortOrder properties. The model is automatically updated if the contents of the store change.

    The following roles are supported by the model:

    Roletype
    subjectstring
    typeenumeration
    sizeint
    senderstring
    toList<string>
    dateDate
    receivedDateDate
    priorityenumeration
    bodystring
    readybool

    Note: since the body can be large and may need to be fetched from the server it is recommended that viewing the body be a user action, and the body role not be bound to until needed. If the body has not yet been downloaded, it will be requested. body will remain undefined until it has been retrieved.

    The ready role is true if the message meta data has been retrieved; otherwise false. Since MessageModel threaded, all messages are initially not ready, and will become ready once the data is available.

    The following example displays the subject, sender and date of all messages sorted in descending order by timestamp:

     import Qt 4.7
     import QtMobility.messaging 1.1
    
     Rectangle {
         width: 320
         height: 480
         ListView {
             id: list
             anchors.fill: parent
             model: MessageModel {
                 sortBy: MessageModel.Timestamp
                 sortOrder: MessageModel.DescendingOrder
             }
             delegate: Item {
                 id: wrapper
                 height: 32; width: list.width
                 Text { id: subjText; text: subject; font.pixelSize: 13; x: 3 }
                 Text {
                     text: sender; color: "gray"; font.pixelSize: 9
                     x: 3; width: parent.width-100;
                     anchors.top: subjText.bottom; anchors.topMargin: 3
                     elide: Text.ElideRight
                 }
                 Text {
                     text: date; color: "gray"; font.pixelSize: 9
                     anchors.right: parent.right
                     anchors.top: subjText.bottom; anchors.topMargin: 3
                 }
             }
         }
     }

    See also MessageFilter.

    Property Documentation

    read-onlycount : int

    Holds the number of messages matching the filter.

    If limit is set then there will be at most limit messages.

    This documentation was introduced in Qt Mobility Mobility 1.1.


    filter : MessageFilter

    The MessageFilter specifying the messages to provide.

    This documentation was introduced in Qt Mobility Mobility 1.1.


    limit : int

    Holds the maximum number of messages to retrieve.

    A value of zero (default) will retrieve all messages.

    This documentation was introduced in Qt Mobility Mobility 1.1.


    sortBy : enumeration

    Specifies the role to sort by:

    This documentation was introduced in Qt Mobility Mobility 1.1.


    sortOrder : enumeration

    Specifies the sort order:

    This documentation was introduced in Qt Mobility Mobility 1.1.


    Signal Documentation

    MessageModel::messageAdded ()

    This handler is called when a message that matches the filter criteria is added to the store. The model will be updated shortly and will include the new message.

    This documentation was introduced in Qt Mobility Mobility 1.1.


    Method Documentation

    MessageModel::removeMessage ( index )

    Remove the message at index from the mail store and the originating server (if applicable).

    This documentation was introduced in Qt Mobility Mobility 1.1.


    MessageModel::showMessage ( index )

    Displays the message at index using the system message client.

    This documentation was introduced in Qt Mobility Mobility 1.1.


    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 qtmobility-1.2
    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