En esta página

placeAttribute QML Value Type

El tipo «placeAttribute» contiene información genérica sobre los atributos de un lugar. Más información...

Import Statement: import QtLocation 6.12
Since: QtLocation 5.5

Propiedades

Descripción detallada

Un atributo de lugar almacena un dato adicional sobre un « Place » que no se muestra de otro modo a través del tipo « Place ». Un «placeAttribute» es un dato textual, al que se puede acceder a través de la propiedad « text » y de « label ». Tanto la propiedad «l {placeAttribute::}{text}» como la propiedad « label » están pensadas para mostrarse al usuario. Los «placeAttributes» se almacenan en un mapa « ExtendedAttributes » con una clave única.

El siguiente ejemplo muestra cómo mostrar todos los atributos en una lista:

import QtQuick
import QtPositioning
import QtLocation

ListView {
    model: place.extendedAttributes.keys()
    delegate: Text {
        text: "<b>" + place.extendedAttributes[modelData].label + ": </b>" +
              place.extendedAttributes[modelData].text
    }
}

El siguiente ejemplo muestra cómo asignar y modificar un atributo:

    //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"

Documentación de propiedades

label : string

Esta propiedad contiene la etiqueta del atributo, que es una cadena visible para el usuario que describe el atributo.

text : string

Esta propiedad contiene el atributo «text», que puede utilizarse para mostrar información adicional sobre el lugar.

© 2026 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.