Nesta página

placeAttribute QML Value Type

O tipo `placeAttribute` contém informações genéricas sobre atributos de local. Mais...

Import Statement: import QtLocation 6.12
Since: QtLocation 5.5

Propriedades

Descrição detalhada

Um atributo de local armazena uma informação adicional sobre um atributo de localização ( Place ) que não é divulgada de outra forma por meio do tipo de localização ( Place ). Um `placeAttribute` é um dado textual, acessível por meio da propriedade ` text ` e de um ` label`. Tanto a propriedade `l {placeAttribute::}{text}` quanto a ` label ` destinam-se a ser exibidas ao usuário. Os `placeAttributes` são armazenados em um mapa ` ExtendedAttributes ` com uma chave exclusiva.

O exemplo a seguir mostra como exibir todos os atributos em uma 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
    }
}

O exemplo a seguir mostra como atribuir e modificar um 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"

Documentação das propriedades

label : string

Essa propriedade contém o rótulo do atributo, que é uma sequência de caracteres visível ao usuário que descreve o atributo.

text : string

Essa propriedade contém o atributo “text”, que pode ser usado para exibir informações adicionais sobre o local.

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