QML MessageModel ElementThe MessageModel element provides access to messages. More... PropertiesSignalsMethodsDetailed DescriptionThis 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:
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 DocumentationThe MessageFilter specifying the messages to provide. Holds the maximum number of messages to retrieve. A value of zero (default) will retrieve all messages. Specifies the role to sort by:
Specifies the sort order:
Signal DocumentationThis 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. Method DocumentationRemove the message at index from the mail store and the originating server (if applicable). © 2008-2010 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy X
|