placeAttribute QML Value Type
Il tipo `placeAttribute` contiene informazioni generiche sugli attributi dei luoghi. Per saperne di più...
| Import Statement: | import QtLocation 6.12 |
| Since: | QtLocation 5.5 |
Proprietà
Descrizione dettagliata
Un attributo "place" memorizza un'informazione aggiuntiva relativa a un'Place, che non è altrimenti disponibile tramite il tipo Place. Un "placeAttribute" è un dato testuale, accessibile tramite la proprietà " text " e un " label". Sia la proprietà "l {placeAttribute::}{text}" che quella " label " sono destinate alla visualizzazione all'utente. I "placeAttribute" sono memorizzati in una mappa " ExtendedAttributes " con una chiave univoca.
L'esempio seguente mostra come visualizzare tutti gli attributi in un elenco:
import QtQuick
import QtPositioning
import QtLocation
ListView {
model: place.extendedAttributes.keys()
delegate: Text {
text: "<b>" + place.extendedAttributes[modelData].label + ": </b>" +
place.extendedAttributes[modelData].text
}
}L’esempio seguente illustra come assegnare e modificare un attributo:
//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"Documentazione sulle proprietà
label : string
Questa proprietà contiene l'etichetta dell'attributo, ovvero una stringa visibile all'utente che descrive l'attributo.
text : string
Questa proprietà contiene il testo dell'attributo, che può essere utilizzato per mostrare ulteriori informazioni sul luogo.
© 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.