The LandmarkModel element provides access to landmarks. More...
Inherits LandmarkAbstractModel
This element was introduced in Mobility 1.2.
This 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.
The 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 property group was introduced in Mobility 1.2.
See also LandmarkUnionFilter, LandmarkIntersectionFilter, LandmarkNameFilter, LandmarkProximityFilter, LandmarkBoxFilter, and LandmarkCategoryFilter.
importFile : string |
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 property group was introduced in Mobility 1.2.
read-onlylandmarks : QDeclarativeListProperty |
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 property group was introduced in Mobility 1.2.
Imports landmarks (and categories) in importFile.
This documentation was introduced in Mobility 1.2.
© 2008-2011 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
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.