Messaging QML PluginOverviewThe identifying string for this component is "QtMobility.messaging". Use this in the QML import statement. The Messaging QML plugin supplies filters to search for messages with particular values for various properties in the message. The Message itself is represented by a model called a MessageModel. This model supplies a rich selection of properties to display or to use as filter criteria. We can also construct a series of filters and combine them using the MessageIntersectionFilter and MessageUnionFilter to represent a logical 'and' and 'or' of the results. Other properties also give control over the filter logic, such as MessageFilter::negated and the Comparators. FiltersA filter query is made of various parts. Below is a list of some of the things that may be used to construct a search
As an example consider the follow QML code which has a MessageModel element containing a filter. The filter is made up of an intersection of the message Size less than 1024 AND a union of (Sender is "martin" AND Subject does not include "re:") OR Sender includes "don". Notice the use of the property value which contains the tested value. The MessageModel sets the sortBy and sortOrder so that the results are ordered by Timestamp in DescendingOrder. import QtMobility.messaging 1.1 model: MessageModel { sortBy: MessageModel.Timestamp sortOrder: MessageModel.DescendingOrder filter: MessageIntersectionFilter { MessageFilter { type: MessageFilter.Size value: 1024 comparator: MessageFilter.LessThan } MessageUnionFilter { MessageIntersectionFilter { MessageFilter { type: MessageFilter.Sender value: "martin" comparator: MessageFilter.Includes } MessageFilter { negated: true type: MessageFilter.Subject value: "re:" comparator: MessageFilter.Includes } } MessageFilter { type: MessageFilter.Sender value: "don" comparator: MessageFilter.Includes } } } } The MessageModel ElementThe MessageModel element provides access to the returned list of results allowing both control of the list and access to the data of particular messages. In the following snippet of code the delegate, of the unshown ListView element, accesses various fields of each message in the list to display a meaningful list of message items. 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 } } The code displays a list of messages showing the sender and subject details. The MessageModel element also enables the use of the platform message display tool so that after a message is selected it can be correctly displayed. Elements
|
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
![]()
![]() Le Qt Labs au hasard![]() Améliorer les performances de Qt lors du rendu avec plus de SIMDLes 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 utilesContact
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 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 ! |
Copyright © 2000-2012 - www.developpez.com