ExtendedAttributes QML Type

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

Import Statement: import QtLocation 5.3
Since: Qt Location 5.0
Instantiates: QQmlPropertyMap

Signals

Methods

Detailed Description

The ExtendedAttributes type is a map of PlaceAttributes. To access attributes in the map use 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.

keydescription
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 instances are only ever used in the context of Places. It is not possible to create an ExtendedAttributes instance directly or re-assign a Place's ExtendedAttributes property. Modification of 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.


© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.