MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QML LandmarkCategoryModel Element

The LandmarkCategoryModel element provides access to categories. More...

Inherits LandmarkAbstractModel

This element was introduced in Mobility 1.2.

Properties

Detailed Description

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

LandmarkCategoryModel provides a model of categories from the categories store. The contents of the model can be specified with landmark, and sorted via the LandmarkAbstractModel::sortBy and LandmarkAbstractModel::sortOrder properties. Whether the model is automatically updated when the store or landmark changes, can be controlled with LandmarkAbstractModel::autoUpdate property.

There are two ways of accessing the category data: via model by using views and delegates, or alternatively via categories 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 category. Through that one can access any data provided by the LandmarkCategory element.

 LandmarkCategoryModel {
     id: landmarkCategoryModel
     autoUpdate: true
     onModelChanged: console.log("Category model changed, category count: " + count)
 }

 Coordinate {
     id: initCoordinate
     latitude: -27.5
     longitude: 153
 }

 Component {
     id: landmarkCategoryListDelegate
     Item {
         width: 200; height: 50
         Text {
             color: "white"; font.bold: true; style: Text.Raised; styleColor: "black"
             id: nameField; text: category.name
         }
     }
 }

See also LandmarkAbstractModel, LandmarkModel, and QLandmarkManager.

Property Documentation

read-onlycategories : QDeclarativeListProperty

This element holds the list of LandmarkCategory elements that the model currently has. Accessing categories by iterating over this list is not guaranteed to be in the order set by LandmarkAbstractModel::sortBy or LandmarkAbstractModel::sortOrder

 LandmarkCategoryModel {
     id: categoriesOfGivenLandmark
     autoUpdate: false
     onCategoriesChanged: {
         console.log("log: Categories count is: "+ count);
         for (var index = 0; index < categories.length; index++)  {
             console.log("Index, name:" + index + " , " + categories[index].name);
         }
     }
 }

This property group was introduced in Mobility 1.2.


landmark : Landmark

Landmark whose categories the model should represent. Note that the landmark needs to be from LandmarkModel because its internal category identifiers need to be set.

This property group was introduced in Mobility 1.2.