En esta página

placeAttribute QML Value Type

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

Import Statement: import QtLocation 6.11
Since: QtLocation 5.5

Propiedades

Descripción detallada

Un atributo de lugar almacena un dato adicional sobre un Place que no está expuesto de otro modo a través del tipo Place. Un placeAttribute es un dato textual, accesible a través de la propiedad text, y un label. Tanto las propiedades l {placeAttribute::}{text} como label están pensadas para ser mostradas 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 texto del atributo 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.