diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-11-28 17:47:00 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-11-29 23:02:25 +0000 |
commit | 057fe199941b8783312abeedde315118b59ccb8e (patch) | |
tree | 293194d2e0c705d71c9b5d1b809da3e378a6bf40 /src/location/declarativemaps/qdeclarativegeomaneuver.cpp | |
parent | e5fab0a22988ed98657a4954b0104cc25213effc (diff) | |
download | qtlocation-057fe199941b8783312abeedde315118b59ccb8e.tar.gz |
Add extended attributes to QGeoManeuver/QDeclarativeGeoManeuver
Change-Id: I6ed1d869d0a97e397057e92cf17ce9fddb4eca3f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomaneuver.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomaneuver.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomaneuver.cpp b/src/location/declarativemaps/qdeclarativegeomaneuver.cpp index b1c67167..ef3639af 100644 --- a/src/location/declarativemaps/qdeclarativegeomaneuver.cpp +++ b/src/location/declarativemaps/qdeclarativegeomaneuver.cpp @@ -185,6 +185,36 @@ QGeoCoordinate QDeclarativeGeoManeuver::waypoint() const } /*! + \qmlproperty Object RouteManeuver::extendedAttributes + + This property holds the extended attributes of the maneuver and is a map. + These attributes are plugin specific, and can be empty. + + Consult the \l {Qt Location#Plugin References and Parameters}{plugin documentation} + for what attributes are supported and how they should be used. + + Note, due to limitations of the QQmlPropertyMap, it is not possible + to declaratively specify the attributes in QML, assignment of attributes keys + and values can only be accomplished by JavaScript. + + \since QtLocation 5.11 +*/ +QQmlPropertyMap *QDeclarativeGeoManeuver::extendedAttributes() const +{ + if (!m_extendedAttributes) { + QDeclarativeGeoManeuver *self = const_cast<QDeclarativeGeoManeuver *>(this); + self->m_extendedAttributes = new QQmlPropertyMap(self); + // Fill it + const QStringList keys = maneuver_.extendedAttributes().keys(); + for (const QString &key: keys) { + self->m_extendedAttributes->insert(key, + maneuver_.extendedAttributes().value(key)); + } + } + return m_extendedAttributes; +} + +/*! \qmlproperty bool RouteManeuver::waypointValid This read-only property holds whether this \l waypoint, associated with this |