- Qt 6.12
- Qt Location
- QML Types
- ExtendedAttributes
- Qt 6.12.0 Reference Documentation

# ExtendedAttributes QML Type

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

Import Statement: | `import QtLocation 6.12`
Since: | QtLocation 5.5
In C++: | QQmlPropertyMap

- List of all members, including inherited members

## Signals

- void valueChanged(string key, variant value)

## Methods

- variant keys()

## 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.

key | description
--- | ---
openingHours | The trading hours of the place
payment | The types of payment the place accepts, for example visa, mastercard.
x_provider | The name of the provider that a place is sourced from
x_id_<provider> (for example x_id_here) | 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
     import QtLocation

     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; 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`.

Note: The corresponding handler is `onValueChanged`.

## Method Documentation

### variant keys()

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