QML LandmarkModel ElementThe LandmarkModel element provides access to landmarks. More... Inherits LandmarkAbstractModel Properties
MethodsDetailed DescriptionThis element is part of the QtMobility.location 1.1 module. LandmarkModel provides a model of landmarks from the landmarks store. The contents of the model can be specified with a filter, and sorted with the LandmarkAbstractModel::sortBy and LandmarkAbstractModel::sortOrder properties. Whether the model is automatically updated when the store or filter changes, can be controlled with LandmarkAbstractModel::autoUpdate property. There are two ways of accessing the landmark data: through model by using views and delegates, or alternatively via landmarks list property. Of the two, the model access is preferred. Direct list access (i.e. non-model) is not guaranteed to be in order set by sortBy and sortOrder. At the moment only data role provided by the model is landmark (Landmark). Through that one can access any data provided by the Landmark element. The following example illustrates fetching of all landmarks in ascending name order. Example illustrates both model access as well as direct list access. Rectangle { width: 350 height: 350 // The model LandmarkModel { id: myLandmarkModel sortBy: LandmarkModel.NameSort; sortOrder: LandmarkModel.AscendingOrder limit: 15 onLandmarksChanged: { // Direct list access for (var index = 0; index < landmarks.length; index++) { console.log("Index, name:" + index + " , " + landmarks[index].name); } } } // The view ListView { id: myLandmarkListView model: landmarkModel delegate: myLandmarkListDelegate width: parent.width; height: parent.height highlightFollowsCurrentItem: false focus: true anchors.fill: parent keyNavigationWraps: true } // The delegate Component { id: myLandmarkListDelegate Item { width: 200; height: 20 Text {id: nameField; text: landmark.name } Text { id: phoneField; text: " tel:" + landmark.phoneNumber; anchors.left: nameField.right;} } } } See also LandmarkAbstractModel, LandmarkCategoryModel, and QLandmarkManager. Property DocumentationThe filter for filtering landmarks. LandmarkNameFilter { id: coralFilter name: "Flinders Reef" } LandmarkModel { id: landmarkModel filter: coralFilter // Alternatively filter could be declared directly, e.g: /* filter: LandmarkIntersectionFilter { LandmarkNameFilter { ... } LandmarkUnionFilter { LandmarkIntersectionFilter { LandmarkNameFilter { ... } LandmarkProximityFilter { ... } } } } */ limit: 100 } This documentation was introduced in Qt Mobility Mobility 1.2. See also LandmarkUnionFilter, LandmarkIntersectionFilter, LandmarkNameFilter, LandmarkProximityFilter, LandmarkBoxFilter, and LandmarkCategoryFilter. Landmarks and their related categories can be imported by setting the import file. If LandmarkAbstractModel::autoUpdate is true, the import will be done automatically and as a result model updates. Alternatively importLandmarks() can be invoked. For supported file formats, refer to QLandmarkManager and QLandmarkImportRequest. LandmarkModel { id: landmarkModelForImport importFile: "mylandmarkfile.gpx" } This documentation was introduced in Qt Mobility Mobility 1.2. This element holds the list of Landmark elements that the model currently has. Accessing landmarks by iterating over this list is not guaranteed to be in the order set by LandmarkAbstractModel::sortBy or LandmarkAbstractModel::sortOrder LandmarkModel { id: landmarkModelForIteration onLandmarksChanged: { console.log("log: Landmark count is: "+ count); for (var index = 0; index < landmarks.length; index++) { console.log("Index, name:" + index + " , " + landmarks[index].name); } } } This documentation was introduced in Qt Mobility Mobility 1.2. Method DocumentationImports landmarks (and categories) in importFile. This documentation was introduced in Qt Mobility Mobility 1.2. |
Publicité
Best OfActualités les plus luesSemaine
Mois
Année
![]()
![]() Le blog Digia au hasard![]() Déploiement d'applications Qt Commercial sur les tablettes Windows 8Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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