placeAttribute QML Value Type
Le type placeAttribute contient des informations génériques sur les attributs des lieux. Plus d'informations...
| Import Statement: | import QtLocation 6.11 |
| Since: | QtLocation 5.5 |
Propriétés
Description détaillée
Un attribut de lieu stocke un élément d'information supplémentaire sur une Place qui n'est pas exposé par l'intermédiaire du type Place. Un attribut de lieu est une donnée textuelle, accessible par la propriété text, et une propriété label. Les propriétés l {placeAttribute::}{text} et label sont destinées à être affichées pour l'utilisateur. Les attributs de lieu sont stockés dans une carte ExtendedAttributes avec une clé unique.
L'exemple suivant montre comment afficher tous les attributs dans une liste :
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'exemple suivant montre comment attribuer et modifier un attribut :
//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"
Propriété Documentation
label : string
Cette propriété contient l'étiquette de l'attribut qui est une chaîne visible par l'utilisateur décrivant l'attribut.
text : string
Cette propriété contient le texte de l'attribut qui peut être utilisé pour afficher des informations supplémentaires sur le lieu.
© 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.