PlaceAttribute QML Type
The PlaceAttribute type holds generic place attribute information. More...
Import Statement: | import QtLocation 5.15 |
Since: | QtLocation 5.5 |
Properties
Detailed Description
A place attribute stores an additional piece of information about a Place that is not otherwise exposed through the Place type. A PlaceAttribute is a textual piece of data, accessible through the text property, and a label. Both the text and label properties are intended to be displayed to the user. PlaceAttributes are stored in an ExtendedAttributes map with a unique key.
The following example shows how to display all attributes in a list:
import QtQuick 2.0 import QtPositioning 5.5 import QtLocation 5.6 ListView { model: place.extendedAttributes.keys() delegate: Text { text: "<b>" + place.extendedAttributes[modelData].label + ": </b>" + place.extendedAttributes[modelData].text } }
The following example shows how to assign and modify an attribute:
//assign a new attribute to a place var smokingAttrib = Qt.createQmlObject('import QtLocation 5.3; PlaceAttribute {}', place); smokingAttrib.label = "Smoking Allowed" smokingAttrib.text = "No" place.extendedAttributes.smoking = smokingAttrib; //modify an existing attribute place.extendedAttributes.smoking.text = "Yes"
Property Documentation
For details on how to use this property to interface between C++ and QML see "Interfaces between C++ and QML Code".
label : string |
This property holds the attribute label which is a user visible string describing the attribute.
text : string |
This property holds the attribute text which can be used to show additional information about the place.
© 2024 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.