Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QML Places API

Overview

The Places API allows users to discover places of interest and view details about them, such as address and contact information. Some places may have additional content associated with them, such as images and reviews. The Places API also facilitates management of places and categories, allowing users to save and remove them.

Quickstart Tutorial

Plugin Initialization

A Plugin is an abstraction for a backend. One Plugin might access places from a REST server while another may access places from a local database. The following instantiates a Plugin element by providing a name of "nokia". The Plugin name identifies which backend to choose from. Note that different Plugin backends may have different nuances and behaviours, refer to the Plugin References for these details.


See also the overview for the C++ API which introduces aspects of the API in greater detail.

Searching

Searching is accomplished via the PlaceSearchModel. To instantiate a PlaceSearchModel we provide a Plugin and some search parameters such as a search center and search text. The model can be used with a ListView and delegate to display the results. A search operation is started by invoking the PlaceSearchModel::execute() method.


The PlaceSearchModel can also be used in conjuction with a MapItemView to display markers on a map. The MapItemView's model is set to the search model, and for the delegate we use a MapQuickItem to display and position a given marker image. A marker is shown for every place that was found by the search model.


The search model may also be used to specify whether corrections are returned. See the documentation for PlaceSearchModel for details.

Fetching Details

In order to save bandwidth, sometimes a backend will only return places which are partially populated with details. This can be checked with the Place::detailsFetched property which indicates whether all availalable details have been fetched or not. If not, the Place::getDetails() method can be invoked to fetch the missing details.



Saving and Removing Places

Some backends may support saving and removing places. This can be done by calling the Place::save() and Place::remove() functions, respectively. Note that in order to save a Place, a Plugin must be assigned to specify which backend we are saving to.



Learn More

The above quickstart tutorial only exhibits a subset of Places functionality. Refer to the Places Elements shown below for richer content such as recommendations, images, reviews etc, as well as more indepth descriptions and explanations.

See also the QML Places Example for a more comprehensive demonstration on how to use the API.

Places Elements

Data Elements

QtLocation5::Category

The Category element represents a category that a Place can be associated with.

QtLocation5::ContactDetail

The ContactDetail element holds a contact detail such as a phone number or a website address.

QtLocation5::ContactDetails

The ContactDetails element holds contact details for a Place.

QtLocation5::ExtendedAttributes

The ExtendedAttributes element holds additional data about a Place.

QtLocation5::Icon

The Icon element represents an icon image source which can have multiple sizes.

QtLocation5::Place

The Place element represents a place.

QtLocation5::PlaceAttribute

The PlaceAttribute element holds generic place attribute information.

QtLocation5::Ratings

The Ratings element holds place rating information.

QtLocation5::Supplier

The Supplier element holds data regarding the supplier of a place, a place's image, review, or editorial.

QtLocation5::User

The User element identifies a user who contributed a particular Place content item.

Models

QtLocation5::CategoryModel

The CategoryModel element provides a model of the categories supported by a Plugin.

QtLocation5::EditorialModel

The EditorialModel element provides a model of place editorials.

QtLocation5::ImageModel

The ImageModel element provides a model of place images.

QtLocation5::PlaceRecommendationModel

The PlaceRecommendationModel element provides a model of place recommendations.

QtLocation5::PlaceSearchModel

The PlaceSearchModel element provides access to place search results.

QtLocation5::PlaceSearchSuggestionModel

The PlaceSearchSuggestionModel element provides access to search term suggestions.

QtLocation5::ReviewModel

The ReviewModel element provides access to reviews of a Place.

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 5.0-snapshot
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 !
 
 
 
 
Partenaires

Hébergement Web