How to set the QML property MapPolyline Path

I have an object MapPolylinein my QtQuick project. I need to change the path property from a C ++ file, but I don't know how to do this.

My qml - File:

MapPolyline {
    id: mapline
    objectName: "MapLine"
    line.width: 5
    line.color: "green"
    path:
    {[
        { latitude: 47.219791, longitude: 9.546032 },
        { latitude: 47.219657, longitude: 9.542508 },
        { latitude: 47.2194446, longitude: 9.5437876 }
    ]}
}

And now I want to change the contents of the path property from a C ++ file.

Thanks for the help!

+4
source share
2 answers

Qt ++. QJSValue. QObject QVariantList. QVariantList QGeoCoordinate ( ). QML MapPolyline QObject QVariantList. QML QVariantList Javascript. QGeoCoordinates - qml, . , "" qml, QVariantList ++ QVariantMap, Javascript ( Q_GADGET).

, , , QGeoCoordinates, ++, . QGeoCoordinates , MapPolyLine : " ". QVariantList , QGeoCoordinate isValid().

+1

Qt Location, , , ++- (QML) API , ++ API. , , work-in- , ++ API.

, , , QDeclarativePolylineMapItem::setPath(), parseCoordinate(), . , QObject::findObject() ( ) MapPolyline ++, QJSValue ( , QJSEngine), setPath().

0

Source: https://habr.com/ru/post/1607450/


All Articles