IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

placeAttribute QML Value Type

The placeAttribute type holds generic place attribute information.

This type was introduced in QtLocation 5.5.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

placeAttribute QML Value Type

  • Import Statement: import QtLocation 6.5

  • Since: QtLocation 5.5

  • Group: placeAttribute is part of qml-QtLocation5-places, qml-QtLocation5-places-data

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 l {placeAttribute::}{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:

 
Sélectionnez
import QtQuick
import QtPositioning
import QtLocation

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:

 
Sélectionnez
    //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"

Property Documentation

 

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.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+