The ExtendedAttributes type holds additional data about a Place. More...

Import Statement: import QtLocation 5.3
Since: Qt Location 5.0



Detailed Description

The keys() method to get the list of keys stored in the map and use the [] operator to access the PlaceAttribute items.

The following are standard keys that are defined by the API. Plugin implementations are free to define additional keys. Custom keys should be qualified by a unique prefix to avoid clashes.

openingHoursThe trading hours of the place
paymentThe types of payment the place accepts, for example visa, mastercard.
x_providerThe name of the provider that a place is sourced from
x_id_<provider> (for example x_id_nokia)An alternative identifier which identifies the place from the perspective of the specified provider.

Some plugins may not support attributes at all, others may only support a certain set, others still may support a dynamically changing set of attributes over time or even allow attributes to be arbitrarily defined by the client application. The attributes could also vary on a place by place basis, for example one place may have opening hours while another does not. Consult the plugin references for details.

Some attributes may not be intended to be readable by end users, the label field of such attributes is empty to indicate this fact.

Note: ExtendedAttributes can only be accomplished via Javascript.

The following example shows how to access all PlaceAttributes and print them to the console:

import QtPositioning 5.2
import QtLocation 5.3
function printExtendedAttributes(extendedAttributes) {
var keys = extendedAttributes.keys();
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (extendedAttributes[key].label !== "")
console.log(extendedAttributes[key].label + ": " + extendedAttributes[key].text);

The following example shows how to assign and modify an attribute:

    //assign a new attribute to a place
var smokingAttrib = Qt.createQmlObject('import QtLocation 5.3; PlaceAttribute {}', place);
smokingAttrib.label = "Smoking Allowed"
smokingAttrib.text = "No"
place.extendedAttributes.smoking = smokingAttrib;
//modify an existing attribute
place.extendedAttributes.smoking.text = "Yes"

See also PlaceAttribute and QQmlPropertyMap.

Signal Documentation

void valueChanged(string key, variant value)

This signal is emitted when the set of attributes changes. key is the key corresponding to the value that was changed.

The corresponding handler is onValueChanged.

Method Documentation

variant keys()

Returns an array of place attribute keys currently stored in the map.